Compare commits
1077
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
827d2771d1 | ||
|
|
c05531c016 | ||
|
|
90c31465b6 | ||
|
|
424c1a6771 | ||
|
|
acff8885e0 | ||
|
|
2255ece665 | ||
|
|
c5c828b0d7 | ||
|
|
683699bbee | ||
|
|
cca512f01d | ||
|
|
6b76546dcf | ||
|
|
eb3ba0c2c3 | ||
|
|
8aadc00368 | ||
|
|
ca822d9be3 | ||
|
|
e5fea790e3 | ||
|
|
5da8997a13 | ||
|
|
e27a8d49fe | ||
|
|
1434f18b6d | ||
|
|
99899edc16 | ||
|
|
a2522a141b | ||
|
|
fc8ff74267 | ||
|
|
425414661d | ||
|
|
fb2de3a595 | ||
|
|
bcb8e7b38c | ||
|
|
27f602808c | ||
|
|
71ae155ec8 | ||
|
|
7c0adbb656 | ||
|
|
79d2975bc0 | ||
|
|
0c71695c84 | ||
|
|
0bf5a0c570 | ||
|
|
fb1f329976 | ||
|
|
80f8c1f623 | ||
|
|
d65ce3dd77 | ||
|
|
d0a99c5cfb | ||
|
|
80ed214dd0 | ||
|
|
6a0a84f0c8 | ||
|
|
2589b19d17 | ||
|
|
b68fac88dd | ||
|
|
8929c79198 | ||
|
|
5b964e7c74 | ||
|
|
f64ef29706 | ||
|
|
f93f1872c2 | ||
|
|
a7edf8fd62 | ||
|
|
9fc60d7a96 | ||
|
|
c61c22d171 | ||
|
|
f72d5b06ce | ||
|
|
e7df8c283f | ||
|
|
4dc1a32e40 | ||
|
|
f42aea1e37 | ||
|
|
b9408b7f03 | ||
|
|
2d89195de7 | ||
|
|
908e329a60 | ||
|
|
84484853ca | ||
|
|
f869862b9a | ||
|
|
9d3ef66e10 | ||
|
|
587a0fab53 | ||
|
|
eaf7739b36 | ||
|
|
e2c103205b | ||
|
|
c7c13f990b | ||
|
|
b6e3d7f6f3 | ||
|
|
55af02b858 | ||
|
|
a58e394471 | ||
|
|
42248bf405 | ||
|
|
a8c37d0358 | ||
|
|
9741009af3 | ||
|
|
8dd7ee23de | ||
|
|
62a3e5be21 | ||
|
|
398161232b | ||
|
|
ee79a7323e | ||
|
|
675815ec65 | ||
|
|
d734ba72ec | ||
|
|
3d2826abdc | ||
|
|
06fe60927f | ||
|
|
236a65a4ca | ||
|
|
640fac7027 | ||
|
|
e9adffa3ce | ||
|
|
f818ac51c1 | ||
|
|
afa4011bfe | ||
|
|
16d8f5483c | ||
|
|
c25e02ebc5 | ||
|
|
1644ebc921 | ||
|
|
268534dde5 | ||
|
|
f328e2bd80 | ||
|
|
fccb627bdc | ||
|
|
0ae74d6d73 | ||
|
|
c24812bef1 | ||
|
|
2d164b9e18 | ||
|
|
7f6dfea42c | ||
|
|
7e6803ffdc | ||
|
|
8c8a1702b4 | ||
|
|
a1deebb5fc | ||
|
|
fb5b3b7c6c | ||
|
|
8c58e18466 | ||
|
|
4ad9255893 | ||
|
|
65d4c44031 | ||
|
|
e9c0f54a20 | ||
|
|
9b2d72ddca | ||
|
|
f90dd29cb9 | ||
|
|
8c00fa1f08 | ||
|
|
6746a0a057 | ||
|
|
fa33f8fc49 | ||
|
|
427051eb39 | ||
|
|
74c2ac316b | ||
|
|
e34d38d2d9 | ||
|
|
15039e1208 | ||
|
|
389a039ec3 | ||
|
|
5c5a3a3384 | ||
|
|
59c824ab0a | ||
|
|
f18d23cd15 | ||
|
|
f8bbcdb9e9 | ||
|
|
1f0688ee35 | ||
|
|
568e4332b2 | ||
|
|
5de8b391fd | ||
|
|
f6fe265ae1 | ||
|
|
b2e52c51d3 | ||
|
|
88e55d42e4 | ||
|
|
28c0be48eb | ||
|
|
11fc3d992b | ||
|
|
70158374ca | ||
|
|
1af123546b | ||
|
|
6d8c85200a | ||
|
|
042b600c46 | ||
|
|
d8a7621b00 | ||
|
|
512af56522 | ||
|
|
e5c2857d52 | ||
|
|
7465afb0b9 | ||
|
|
aab690a3a3 | ||
|
|
640c75cb8a | ||
|
|
01b246b3ff | ||
|
|
0bfc04780c | ||
|
|
5ff75e303d | ||
|
|
5806b39ef6 | ||
|
|
253fcba9c7 | ||
|
|
1e76d3c7c7 | ||
|
|
561b3fd5bf | ||
|
|
afafc7e28a | ||
|
|
18fcc93475 | ||
|
|
58426b150a | ||
|
|
b7be7f7966 | ||
|
|
5640d16d82 | ||
|
|
c6b6e8d043 | ||
|
|
407bab67fd | ||
|
|
b68651a573 | ||
|
|
ab17ab0ddd | ||
|
|
b460a97abb | ||
|
|
51edfcab8b | ||
|
|
96261364e7 | ||
|
|
5e0cb2cca3 | ||
|
|
5671ff90e0 | ||
|
|
dee57e4860 | ||
|
|
8fb8e09e12 | ||
|
|
8d10938f29 | ||
|
|
b47abb8677 | ||
|
|
36d482e24c | ||
|
|
935d9a55a3 | ||
|
|
f06c809666 | ||
|
|
b910159213 | ||
|
|
a3530b4ee2 | ||
|
|
87df34e35f | ||
|
|
14d4059a06 | ||
|
|
fdc338a241 | ||
|
|
7a03292709 | ||
|
|
222df82924 | ||
|
|
f7badd2742 | ||
|
|
7fbec0e308 | ||
|
|
3ddc507732 | ||
|
|
16d2ffcf46 | ||
|
|
433d3b7942 | ||
|
|
3e80c41d16 | ||
|
|
78012ae9ab | ||
|
|
fcf68d3a16 | ||
|
|
497c61f507 | ||
|
|
dc26989499 | ||
|
|
173aea2bbc | ||
|
|
8f34021826 | ||
|
|
477588caaa | ||
|
|
5abcf42a35 | ||
|
|
cb6d75c5ef | ||
|
|
a0ff3f0a0b | ||
|
|
6c75d64133 | ||
|
|
a249e774d9 | ||
|
|
ffdb77ba88 | ||
|
|
b5ed06fd47 | ||
|
|
45b1f9b446 | ||
|
|
10a92fe8ef | ||
|
|
a10ef1ef84 | ||
|
|
6fbdcf9439 | ||
|
|
1053856b06 | ||
|
|
121c75a3bd | ||
|
|
1a1e714caa | ||
|
|
d2a0e22592 | ||
|
|
a01879b7c7 | ||
|
|
de5dd8b443 | ||
|
|
244dfa38c3 | ||
|
|
ed0ceaa4af | ||
|
|
609315cded | ||
|
|
af188d2bbd | ||
|
|
7bd2258d9e | ||
|
|
38b5d0552d | ||
|
|
9eca52c49e | ||
|
|
2eb6a60d34 | ||
|
|
aebc832c69 | ||
|
|
fe905ccefe | ||
|
|
09db0bc35b | ||
|
|
6c2a2aff4c | ||
|
|
2c980accf4 | ||
|
|
05041c762b | ||
|
|
c864822002 | ||
|
|
b2d4a331d7 | ||
|
|
c9a46799b9 | ||
|
|
f180764680 | ||
|
|
72b7f19a3f | ||
|
|
088f2d6f5b | ||
|
|
97b4bb41f0 | ||
|
|
9556826904 | ||
|
|
ab66859f92 | ||
|
|
f625879de3 | ||
|
|
ca7cdffcf5 | ||
|
|
5a7aa2e7c2 | ||
|
|
89af1bbbee | ||
|
|
ec628b74e2 | ||
|
|
d583c4028c | ||
|
|
b867a9c14b | ||
|
|
96de6bd33f | ||
|
|
d6bd396ade | ||
|
|
1b86b4c0a2 | ||
|
|
f41b48c6b8 | ||
|
|
105cb85ba9 | ||
|
|
1e10574a1f | ||
|
|
c495271d6d | ||
|
|
acb4ca8ad4 | ||
|
|
f4310ec99f | ||
|
|
bbd04d7ac8 | ||
|
|
92767d4761 | ||
|
|
ad1a90074f | ||
|
|
b67f9f0ae5 | ||
|
|
a783b9a2b7 | ||
|
|
bf42064bc0 | ||
|
|
1814599ba7 | ||
|
|
52bc294687 | ||
|
|
9aa3a4403e | ||
|
|
eb009d165b | ||
|
|
c7a212b422 | ||
|
|
8159ac6466 | ||
|
|
f935e4aab7 | ||
|
|
6aae047a80 | ||
|
|
81a39f04d9 | ||
|
|
4f7ddefe48 | ||
|
|
24e0b198bd | ||
|
|
4a104e034b | ||
|
|
a9f049ac92 | ||
|
|
d1bc20291b | ||
|
|
ee51cc3dcb | ||
|
|
40600e3f4a | ||
|
|
5bbb48b3ee | ||
|
|
dcbc020134 | ||
|
|
cda65dfd0e | ||
|
|
0be8d64ace | ||
|
|
36dc48a251 | ||
|
|
8ce0fd0f52 | ||
|
|
c522482edd | ||
|
|
c0e136e0cb | ||
|
|
54536b45d9 | ||
|
|
c18f3a3eb3 | ||
|
|
a1c04b8d90 | ||
|
|
2d4cc7434a | ||
|
|
9bd67912ee | ||
|
|
f63cb72108 | ||
|
|
7975d07cc9 | ||
|
|
7f2c9f03d0 | ||
|
|
ea7d02069f | ||
|
|
0ad543d1ae | ||
|
|
d54d0873c7 | ||
|
|
124ce0e2ae | ||
|
|
3dab3db57c | ||
|
|
622e71a819 | ||
|
|
07204aedee | ||
|
|
28cc5e1b51 | ||
|
|
3f20ca5301 | ||
|
|
ddbf0cf5aa | ||
|
|
4e446d70f0 | ||
|
|
f8f42f0b32 | ||
|
|
97e9679054 | ||
|
|
3339e77cb6 | ||
|
|
b74fff745f | ||
|
|
855b214149 | ||
|
|
f792ad6dbf | ||
|
|
23dac19dfd | ||
|
|
82a508deb5 | ||
|
|
7941930108 | ||
|
|
5fc319879d | ||
|
|
e9dd84d605 | ||
|
|
0e6e6f96bc | ||
|
|
6f5b29db60 | ||
|
|
1b9352d967 | ||
|
|
c3fd16d5fa | ||
|
|
f51a3a7b9a | ||
|
|
ba8ea289c2 | ||
|
|
7c8a1d3fac | ||
|
|
5499b8bc9d | ||
|
|
c460dd8407 | ||
|
|
3b39d9bb43 | ||
|
|
7cb0b8e233 | ||
|
|
ddf0e46965 | ||
|
|
3455696308 | ||
|
|
9158d9311a | ||
|
|
adc2d6fbbf | ||
|
|
4c95201e60 | ||
|
|
13c79b247b | ||
|
|
ef6492a035 | ||
|
|
837a791902 | ||
|
|
d4eb9df491 | ||
|
|
f8eb6afdb0 | ||
|
|
f7780bb4df | ||
|
|
324a2ce95f | ||
|
|
1679781963 | ||
|
|
3a2c5e6e53 | ||
|
|
b0605443b6 | ||
|
|
985d46f9bc | ||
|
|
eb7e0afb9d | ||
|
|
31b29e84f7 | ||
|
|
5905f99fe7 | ||
|
|
cbe51d366d | ||
|
|
0f958078e5 | ||
|
|
f226a48886 | ||
|
|
18ccee7f17 | ||
|
|
ce6fbe7013 | ||
|
|
788dc65a56 | ||
|
|
2a9ef15044 | ||
|
|
ee20d84ee2 | ||
|
|
bb5dcce504 | ||
|
|
6a28cbe06d | ||
|
|
175473a389 | ||
|
|
a851ea27c8 | ||
|
|
5b85f5950f | ||
|
|
4c2f05da63 | ||
|
|
9a4acf47d0 | ||
|
|
fd68b8fef2 | ||
|
|
e48bd15d48 | ||
|
|
5c838c451c | ||
|
|
a3b874a5aa | ||
|
|
68c2f1c864 | ||
|
|
ccc5ec1aa9 | ||
|
|
920e0dc10c | ||
|
|
d804e46dd3 | ||
|
|
8391c7fa0d | ||
|
|
e248aa88f2 | ||
|
|
66ef5c38ae | ||
|
|
6894ca08e7 | ||
|
|
39119f5560 | ||
|
|
ec3d4f03c8 | ||
|
|
45bc8b0861 | ||
|
|
36fd724d7c | ||
|
|
66ed237c0c | ||
|
|
259b2b0150 | ||
|
|
6cc79b0ec8 | ||
|
|
5019a79e7f | ||
|
|
a91976d33e | ||
|
|
42aaf7bd17 | ||
|
|
ba72a7cae1 | ||
|
|
4f35c84c7c | ||
|
|
51e4a89677 | ||
|
|
2042033bf6 | ||
|
|
a719466871 | ||
|
|
9ea6f91c09 | ||
|
|
9df9b1cc7d | ||
|
|
1adac52f52 | ||
|
|
30a6b12196 | ||
|
|
857d205eb8 | ||
|
|
ebf57ecf3c | ||
|
|
759ff6e947 | ||
|
|
b83bc997b5 | ||
|
|
26ec8437cc | ||
|
|
d4ff1e8c99 | ||
|
|
5bae6c7481 | ||
|
|
ba4dbfbe66 | ||
|
|
d55b2527be | ||
|
|
aab47c6a8f | ||
|
|
a7c7de4ffa | ||
|
|
28c5086082 | ||
|
|
5aa2ed8035 | ||
|
|
f0c5f828d9 | ||
|
|
3ea9c498b8 | ||
|
|
19d506f4b3 | ||
|
|
30439321e9 | ||
|
|
49d727ee9b | ||
|
|
18052a67bf | ||
|
|
0f0d005767 | ||
|
|
b25060fc8e | ||
|
|
23fe4f9c74 | ||
|
|
b816e3c75d | ||
|
|
96061225ad | ||
|
|
66abb91981 | ||
|
|
adb322a1eb | ||
|
|
3b6d4b4726 | ||
|
|
56fc5d3264 | ||
|
|
3401df8563 | ||
|
|
ca8965eff4 | ||
|
|
2df3df77bd | ||
|
|
329649b33d | ||
|
|
576d53b7ff | ||
|
|
2fbb1b41bb | ||
|
|
8769c3873c | ||
|
|
80a8255d3b | ||
|
|
ed205e403b | ||
|
|
5de2f0edad | ||
|
|
a688fdd095 | ||
|
|
80101684d5 | ||
|
|
ec755a539b | ||
|
|
61d000e3a6 | ||
|
|
1eff287609 | ||
|
|
c23811e237 | ||
|
|
7b38dca5fa | ||
|
|
ddf5f5c013 | ||
|
|
d5655e4f0a | ||
|
|
c6e698f886 | ||
|
|
16e3f6b897 | ||
|
|
2d631e21f9 | ||
|
|
5f3c68f8fd | ||
|
|
a4675adf66 | ||
|
|
de02c0c01f | ||
|
|
ed5d462b65 | ||
|
|
58f1ce55ab | ||
|
|
190a906450 | ||
|
|
3193e8c3f2 | ||
|
|
19a293ca09 | ||
|
|
a614fe2cb2 | ||
|
|
2b91bde4a9 | ||
|
|
016072e45a | ||
|
|
71b93bfe5a | ||
|
|
423049b4e0 | ||
|
|
73fb13fd02 | ||
|
|
9d567674a2 | ||
|
|
dbd90ec41a | ||
|
|
2fef457f32 | ||
|
|
9443ef73fb | ||
|
|
16df8c33a2 | ||
|
|
74d9648b23 | ||
|
|
f9b18a0fd4 | ||
|
|
6499913136 | ||
|
|
20ed6d072f | ||
|
|
7edccad2f9 | ||
|
|
04540f9d16 | ||
|
|
ffa853efcf | ||
|
|
0ec236e6c6 | ||
|
|
07e19cb2eb | ||
|
|
9889cfb32b | ||
|
|
80ac2e8bc0 | ||
|
|
4967970592 | ||
|
|
976b7285e5 | ||
|
|
aab802d7ea | ||
|
|
6be47afd1d | ||
|
|
a350d715a3 | ||
|
|
cfff7a887b | ||
|
|
51199ddd6e | ||
|
|
c1ac5c1f55 | ||
|
|
279bd70ebc | ||
|
|
db0e85d9ed | ||
|
|
af7731a663 | ||
|
|
1899cfc7f9 | ||
|
|
17ac70dca5 | ||
|
|
60bc74f6c9 | ||
|
|
919a465c21 | ||
|
|
964c777795 | ||
|
|
188b145203 | ||
|
|
3e6f464aaa | ||
|
|
acdc2c5543 | ||
|
|
983e729396 | ||
|
|
e06cfa0d32 | ||
|
|
8a278ddb83 | ||
|
|
9feb2b3e15 | ||
|
|
97b2b3e9a8 | ||
|
|
f804ae1605 | ||
|
|
b914e3c915 | ||
|
|
8fbce26eb6 | ||
|
|
e156096762 | ||
|
|
88e83474ab | ||
|
|
57513f8fb9 | ||
|
|
20c5277925 | ||
|
|
cbe3bddd7b | ||
|
|
2b1e6456a0 | ||
|
|
867cf6dd43 | ||
|
|
98dff3ef2e | ||
|
|
4aae54f24c | ||
|
|
7ef5de4da0 | ||
|
|
d7fb7aa630 | ||
|
|
c8c57e0527 | ||
|
|
202d8ae18a | ||
|
|
388f44926b | ||
|
|
daa42f1f36 | ||
|
|
09c91f6721 | ||
|
|
b3720bfde2 | ||
|
|
afd3ffee3a | ||
|
|
478df9170e | ||
|
|
f31fb8c968 | ||
|
|
b7c33bc901 | ||
|
|
351b088194 | ||
|
|
ff4a432aef | ||
|
|
e6764934c6 | ||
|
|
fd5ac156bf | ||
|
|
540401dd2e | ||
|
|
8c0e86c171 | ||
|
|
51c110923d | ||
|
|
d319fd3eab | ||
|
|
f4d8b559b5 | ||
|
|
1083340bf8 | ||
|
|
7ebc4fe9bf | ||
|
|
7816413b89 | ||
|
|
86d6a40827 | ||
|
|
314727537c | ||
|
|
2745f73f50 | ||
|
|
0cf2674079 | ||
|
|
0c2f895eaf | ||
|
|
d759d62915 | ||
|
|
1a36f98cd3 | ||
|
|
1451f87536 | ||
|
|
1c2d3ce786 | ||
|
|
91ee7f4ea2 | ||
|
|
33b8e11f16 | ||
|
|
e2b21c085a | ||
|
|
2035e9ff46 | ||
|
|
c8dc94cb97 | ||
|
|
b6ce2847b0 | ||
|
|
a264bce2cc | ||
|
|
195d9bfa33 | ||
|
|
70f8569d21 | ||
|
|
656292340c | ||
|
|
9cb958801d | ||
|
|
43c304405e | ||
|
|
78467ad343 | ||
|
|
eac48aad1f | ||
|
|
b9d9a703ea | ||
|
|
92e06ff3b8 | ||
|
|
7a2869ddd0 | ||
|
|
dcd3707b67 | ||
|
|
6ba70fd77e | ||
|
|
01cc957114 | ||
|
|
4ebaf8d793 | ||
|
|
b412d74bab | ||
|
|
079748fab4 | ||
|
|
5e93326a94 | ||
|
|
bfb41c6d84 | ||
|
|
8c0c378821 | ||
|
|
813ea4c5ec | ||
|
|
53634baec7 | ||
|
|
20dc022fe2 | ||
|
|
733679d322 | ||
|
|
eaa2dd583a | ||
|
|
7609f34290 | ||
|
|
40879c10de | ||
|
|
2fe641407a | ||
|
|
264f51d510 | ||
|
|
185149a645 | ||
|
|
c13190ff1b | ||
|
|
eba02b1915 | ||
|
|
b86be66239 | ||
|
|
6b34a94fb3 | ||
|
|
615686f5b1 | ||
|
|
1bdc1b4230 | ||
|
|
b72906a340 | ||
|
|
decb479007 | ||
|
|
eba5e64e49 | ||
|
|
af5d3dc3d2 | ||
|
|
1d10a2b780 | ||
|
|
843f2c4aca | ||
|
|
cc81d618f5 | ||
|
|
3347b54081 | ||
|
|
6c721a47fd | ||
|
|
7065c1438e | ||
|
|
5d83dfbbc9 | ||
|
|
eda4c5d397 | ||
|
|
4d4ab516f0 | ||
|
|
cd766d6795 | ||
|
|
5152f0455a | ||
|
|
e5a93877e6 | ||
|
|
44a1195314 | ||
|
|
c16db4d1a0 | ||
|
|
5c040f17a4 | ||
|
|
430b5425c8 | ||
|
|
8833fe78b0 | ||
|
|
d401ab766f | ||
|
|
00b2325353 | ||
|
|
4011200f72 | ||
|
|
a4ef28b222 | ||
|
|
feb4b99716 | ||
|
|
ac206e3348 | ||
|
|
d76c7136c4 | ||
|
|
1226bc9fe9 | ||
|
|
0345810412 | ||
|
|
9eaf3d2b5d | ||
|
|
64b6703ae0 | ||
|
|
289cf71b8f | ||
|
|
45240a6795 | ||
|
|
ca5390dbed | ||
|
|
8e04471f89 | ||
|
|
23000516a3 | ||
|
|
7eb939c5b8 | ||
|
|
f6ad1b2118 | ||
|
|
2fd8a6e43e | ||
|
|
b85a154e43 | ||
|
|
122223a9aa | ||
|
|
38861c7053 | ||
|
|
a052a532ad | ||
|
|
20da4046b9 | ||
|
|
41af329c44 | ||
|
|
d559c897a4 | ||
|
|
4f216e8de2 | ||
|
|
30a45376af | ||
|
|
291fd1b0b3 | ||
|
|
51970fcb72 | ||
|
|
e699f77a48 | ||
|
|
1992840861 | ||
|
|
467925b5c5 | ||
|
|
384512668b | ||
|
|
26611003d6 | ||
|
|
c1aff393de | ||
|
|
b9c9c90f76 | ||
|
|
9a4aa4bdbf | ||
|
|
bd9ef578ac | ||
|
|
337e7932e3 | ||
|
|
9b449a0a4b | ||
|
|
54e26a6b42 | ||
|
|
430aa0d19e | ||
|
|
faa3a80f73 | ||
|
|
e213cc2765 | ||
|
|
1b08aec38c | ||
|
|
bfd90e3e45 | ||
|
|
ff6e2447b8 | ||
|
|
19797c9b87 | ||
|
|
f80f5f090b | ||
|
|
7d731e82f5 | ||
|
|
49288f161a | ||
|
|
98d29a7a2b | ||
|
|
8fe566d95c | ||
|
|
b4bc19a942 | ||
|
|
e3f13a8285 | ||
|
|
86c4dbf222 | ||
|
|
5e3f6e9ca1 | ||
|
|
47ee171147 | ||
|
|
a8241aabeb | ||
|
|
fcfc54d2b4 | ||
|
|
a895e3a887 | ||
|
|
6c34844486 | ||
|
|
fb57b4d2d6 | ||
|
|
ddeb1421c5 | ||
|
|
196b225035 | ||
|
|
331c1d9cff | ||
|
|
afe3507ec5 | ||
|
|
48e4a4289f | ||
|
|
245b323076 | ||
|
|
b66d5ebe15 | ||
|
|
0b95fc76ba | ||
|
|
57862dec0f | ||
|
|
afc64d8674 | ||
|
|
017e567669 | ||
|
|
387a83e129 | ||
|
|
90aaa41d84 | ||
|
|
1c482b4315 | ||
|
|
5b986a36fc | ||
|
|
e2ff6879dc | ||
|
|
2a236b0dc1 | ||
|
|
68b3c75510 | ||
|
|
0d2d1e9c66 | ||
|
|
d8d155ca5e | ||
|
|
f31e78069c | ||
|
|
dfca574481 | ||
|
|
01cf9d8535 | ||
|
|
f1c2c96fb8 | ||
|
|
f615e9f5b7 | ||
|
|
a3cd7fe761 | ||
|
|
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 | ||
|
|
86dbdd1c62 | ||
|
|
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,84 @@
|
||||
# .clang-format
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignConsecutiveMacros:
|
||||
Enabled: true
|
||||
AcrossEmptyLines: true
|
||||
AcrossComments: true
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: false
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Inline
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: No
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
BeforeCatch: true
|
||||
BeforeElse: true
|
||||
IndentBraces: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
ColumnLimit: 110
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
Cpp11BracedListStyle: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
IncludeBlocks: Regroup
|
||||
IndentCaseLabels: false
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 100000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Auto
|
||||
TabWidth: 2
|
||||
UseTab: Never
|
||||
AlignEscapedNewlines: LeftWithLastLine
|
||||
@@ -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/*
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
.direnv
|
||||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
out/
|
||||
.direnv/
|
||||
.DS_Store
|
||||
.vscode/settings.json
|
||||
.vscode/extensions.json
|
||||
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,116 @@
|
||||
## 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
|
||||
|
||||
- Watch the [MeshCore Intro Video](https://www.youtube.com/watch?v=t1qne8uJBAc) by Andy Kirby.
|
||||
- Read through our [Frequently Asked Questions](./docs/faq.md) section.
|
||||
- Flash the MeshCore firmware on a supported device.
|
||||
- Connect with a supported client.
|
||||
|
||||
For developers;
|
||||
|
||||
- Install [PlatformIO](https://docs.platformio.org) in [Visual Studio Code](https://code.visualstudio.com).
|
||||
- Clone and open the MeshCore repository in Visual Studio Code.
|
||||
- See the example applications you can modify and run:
|
||||
- [Companion Radio](./examples/companion_radio) - For use with an external chat app, over BLE, USB or WiFi.
|
||||
- [Simple Repeater](./examples/simple_repeater) - Extends network coverage by relaying messages.
|
||||
- [Simple Room Server](./examples/simple_room_server) - A simple BBS server for shared Posts.
|
||||
- [Simple Secure Chat](./examples/simple_secure_chat) - Secure terminal based text communication between devices.
|
||||
|
||||
The Simple Secure Chat example can be interacted with through the Serial Monitor in Visual Studio Code, or with a Serial USB Terminal on Android.
|
||||
|
||||
## ⚡️ MeshCore Flasher
|
||||
|
||||
We have prebuilt firmware ready to flash on supported devices.
|
||||
|
||||
- Launch https://flasher.meshcore.co.uk
|
||||
- Select a supported device
|
||||
- Flash one of the firmware types:
|
||||
- Companion, Repeater or Room Server
|
||||
- Once flashing is complete, you can connect with one of the MeshCore clients below.
|
||||
|
||||
## 📱 MeshCore Clients
|
||||
|
||||
**Companion Firmware**
|
||||
|
||||
The companion firmware can be connected to via BLE, USB or WiFi depending on the firmware type you flashed.
|
||||
|
||||
- Web: https://app.meshcore.nz
|
||||
- Android: https://play.google.com/store/apps/details?id=com.liamcottle.meshcore.android
|
||||
- iOS: https://apps.apple.com/us/app/meshcore/id6742354151?platform=iphone
|
||||
- NodeJS: https://github.com/liamcottle/meshcore.js
|
||||
- Python: https://github.com/fdlamotte/meshcore-cli
|
||||
|
||||
**Repeater and Room Server Firmware**
|
||||
|
||||
The repeater and room server firmwares can be setup via USB in the web config tool.
|
||||
|
||||
- https://config.meshcore.dev
|
||||
|
||||
They can also be managed via LoRa in the mobile app by using the Remote Management feature.
|
||||
|
||||
## 🛠 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.
|
||||
|
||||
Here are some general principals you should try to adhere to:
|
||||
* Keep it simple. Please, don't think like a high-level lang programmer. Think embedded, and keep code concise, without any unecessary layers.
|
||||
* No dynamic memory allocation, except during setup/begin functions.
|
||||
* Use the same brace and indenting style that's in the core source modules. (A .clang-format is prob going to be added soon, but please do NOT retroactively re-format existing code. This just creates unnecessary diffs that make finding problems harder)
|
||||
|
||||
## 📞 Get Support
|
||||
|
||||
- Report bugs and request features on the [GitHub Issues](https://github.com/ripplebiz/MeshCore/issues) page.
|
||||
- Find additional guides and components on [my site](https://buymeacoffee.com/ripplebiz).
|
||||
- Join [Andy Kirby's Discord](https://discord.gg/GBxVx2JMAy) to chat with the developers and get help from the community.
|
||||
|
||||
## 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,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 @@
|
||||
This is LittleFS from Adafruit, stripped from things that makes it not compile with stm32 (refs to TinyUSB and free_rtos, mostly)
|
||||
@@ -0,0 +1,10 @@
|
||||
name=Adafruit Little File System Libraries
|
||||
version=0.11.0
|
||||
author=Adafruit
|
||||
maintainer=Adafruit <info@adafruit.com>
|
||||
sentence=Arduino library for ARM Little File System
|
||||
paragraph=Arduino library for ARM Little File System
|
||||
category=Data Storage
|
||||
url=https://github.com/adafruit/Adafruit_nRF52_Arduino
|
||||
architectures=*
|
||||
includes=Adafruit_LittleFS.h
|
||||
@@ -0,0 +1,273 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach for Adafruit Industries
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <string.h>
|
||||
#include "Adafruit_LittleFS.h"
|
||||
|
||||
//#include <Adafruit_TinyUSB.h> // for Serial
|
||||
|
||||
using namespace Adafruit_LittleFS_Namespace;
|
||||
|
||||
#define memclr(buffer, size) memset(buffer, 0, size)
|
||||
#define varclr(_var) memclr(_var, sizeof(*(_var)))
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Implementation
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
Adafruit_LittleFS::Adafruit_LittleFS (void)
|
||||
: Adafruit_LittleFS(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Adafruit_LittleFS::Adafruit_LittleFS (struct lfs_config* cfg)
|
||||
{
|
||||
varclr(&_lfs);
|
||||
_lfs_cfg = cfg;
|
||||
_mounted = false;
|
||||
// _mutex = xSemaphoreCreateMutexStatic(&this->_MutexStorageSpace);
|
||||
}
|
||||
|
||||
Adafruit_LittleFS::~Adafruit_LittleFS ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Initialize and mount the file system
|
||||
// Return true if mounted successfully else probably corrupted.
|
||||
// User should format the disk and try again
|
||||
bool Adafruit_LittleFS::begin (struct lfs_config * cfg)
|
||||
{
|
||||
_lockFS();
|
||||
|
||||
bool ret;
|
||||
// not a loop, just an quick way to short-circuit on error
|
||||
do {
|
||||
if (_mounted) { ret = true; break; }
|
||||
if (cfg) { _lfs_cfg = cfg; }
|
||||
if (nullptr == _lfs_cfg) { ret = false; break; }
|
||||
// actually attempt to mount, and log error if one occurs
|
||||
int err = lfs_mount(&_lfs, _lfs_cfg);
|
||||
PRINT_LFS_ERR(err);
|
||||
_mounted = (err == LFS_ERR_OK);
|
||||
ret = _mounted;
|
||||
} while(0);
|
||||
|
||||
_unlockFS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Tear down and unmount file system
|
||||
void Adafruit_LittleFS::end(void)
|
||||
{
|
||||
_lockFS();
|
||||
|
||||
if (_mounted)
|
||||
{
|
||||
_mounted = false;
|
||||
int err = lfs_unmount(&_lfs);
|
||||
PRINT_LFS_ERR(err);
|
||||
(void)err;
|
||||
}
|
||||
|
||||
_unlockFS();
|
||||
}
|
||||
|
||||
bool Adafruit_LittleFS::format (void)
|
||||
{
|
||||
_lockFS();
|
||||
|
||||
int err = LFS_ERR_OK;
|
||||
bool attemptMount = _mounted;
|
||||
// not a loop, just an quick way to short-circuit on error
|
||||
do
|
||||
{
|
||||
// if already mounted: umount first -> format -> remount
|
||||
if (_mounted)
|
||||
{
|
||||
_mounted = false;
|
||||
err = lfs_unmount(&_lfs);
|
||||
if ( LFS_ERR_OK != err) { PRINT_LFS_ERR(err); break; }
|
||||
}
|
||||
err = lfs_format(&_lfs, _lfs_cfg);
|
||||
if ( LFS_ERR_OK != err ) { PRINT_LFS_ERR(err); break; }
|
||||
|
||||
if (attemptMount)
|
||||
{
|
||||
err = lfs_mount(&_lfs, _lfs_cfg);
|
||||
if ( LFS_ERR_OK != err ) { PRINT_LFS_ERR(err); break; }
|
||||
_mounted = true;
|
||||
}
|
||||
// success!
|
||||
} while(0);
|
||||
|
||||
_unlockFS();
|
||||
return LFS_ERR_OK == err;
|
||||
}
|
||||
|
||||
// Open a file or folder
|
||||
Adafruit_LittleFS_Namespace::File Adafruit_LittleFS::open (char const *filepath, uint8_t mode)
|
||||
{
|
||||
// No lock is required here ... the File() object will synchronize with the mutex provided
|
||||
return Adafruit_LittleFS_Namespace::File(filepath, mode, *this);
|
||||
}
|
||||
|
||||
// Check if file or folder exists
|
||||
bool Adafruit_LittleFS::exists (char const *filepath)
|
||||
{
|
||||
struct lfs_info info;
|
||||
_lockFS();
|
||||
|
||||
bool ret = (0 == lfs_stat(&_lfs, filepath, &info));
|
||||
|
||||
_unlockFS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// Create a directory, create intermediate parent if needed
|
||||
bool Adafruit_LittleFS::mkdir (char const *filepath)
|
||||
{
|
||||
bool ret = true;
|
||||
const char* slash = filepath;
|
||||
if ( slash[0] == '/' ) slash++; // skip root '/'
|
||||
|
||||
_lockFS();
|
||||
|
||||
// make intermediate parent directory(ies)
|
||||
while ( NULL != (slash = strchr(slash, '/')) )
|
||||
{
|
||||
char parent[slash - filepath + 1] = { 0 };
|
||||
memcpy(parent, filepath, slash - filepath);
|
||||
|
||||
int rc = lfs_mkdir(&_lfs, parent);
|
||||
if ( rc != LFS_ERR_OK && rc != LFS_ERR_EXIST )
|
||||
{
|
||||
PRINT_LFS_ERR(rc);
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
slash++;
|
||||
}
|
||||
// make the final requested directory
|
||||
if (ret)
|
||||
{
|
||||
int rc = lfs_mkdir(&_lfs, filepath);
|
||||
if ( rc != LFS_ERR_OK && rc != LFS_ERR_EXIST )
|
||||
{
|
||||
PRINT_LFS_ERR(rc);
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
|
||||
_unlockFS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Remove a file
|
||||
bool Adafruit_LittleFS::remove (char const *filepath)
|
||||
{
|
||||
_lockFS();
|
||||
|
||||
int err = lfs_remove(&_lfs, filepath);
|
||||
PRINT_LFS_ERR(err);
|
||||
|
||||
_unlockFS();
|
||||
return LFS_ERR_OK == err;
|
||||
}
|
||||
|
||||
// Rename a file
|
||||
bool Adafruit_LittleFS::rename (char const *oldfilepath, char const *newfilepath)
|
||||
{
|
||||
_lockFS();
|
||||
|
||||
int err = lfs_rename(&_lfs, oldfilepath, newfilepath);
|
||||
PRINT_LFS_ERR(err);
|
||||
|
||||
_unlockFS();
|
||||
return LFS_ERR_OK == err;
|
||||
}
|
||||
|
||||
// Remove a folder
|
||||
bool Adafruit_LittleFS::rmdir (char const *filepath)
|
||||
{
|
||||
_lockFS();
|
||||
|
||||
int err = lfs_remove(&_lfs, filepath);
|
||||
PRINT_LFS_ERR(err);
|
||||
|
||||
_unlockFS();
|
||||
return LFS_ERR_OK == err;
|
||||
}
|
||||
|
||||
// Remove a folder recursively
|
||||
bool Adafruit_LittleFS::rmdir_r (char const *filepath)
|
||||
{
|
||||
/* adafruit: lfs is modified to remove non-empty folder,
|
||||
According to below issue, comment these 2 line won't corrupt filesystem
|
||||
at least when using LFS v1. If moving to LFS v2, see tracked issue
|
||||
to see if issues (such as the orphans in threaded linked list) are resolved.
|
||||
https://github.com/ARMmbed/littlefs/issues/43
|
||||
*/
|
||||
_lockFS();
|
||||
|
||||
int err = lfs_remove(&_lfs, filepath);
|
||||
PRINT_LFS_ERR(err);
|
||||
|
||||
_unlockFS();
|
||||
return LFS_ERR_OK == err;
|
||||
}
|
||||
|
||||
//------------- Debug -------------//
|
||||
#if CFG_DEBUG
|
||||
|
||||
const char* dbg_strerr_lfs (int32_t err)
|
||||
{
|
||||
switch ( err )
|
||||
{
|
||||
case LFS_ERR_OK : return "LFS_ERR_OK";
|
||||
case LFS_ERR_IO : return "LFS_ERR_IO";
|
||||
case LFS_ERR_CORRUPT : return "LFS_ERR_CORRUPT";
|
||||
case LFS_ERR_NOENT : return "LFS_ERR_NOENT";
|
||||
case LFS_ERR_EXIST : return "LFS_ERR_EXIST";
|
||||
case LFS_ERR_NOTDIR : return "LFS_ERR_NOTDIR";
|
||||
case LFS_ERR_ISDIR : return "LFS_ERR_ISDIR";
|
||||
case LFS_ERR_NOTEMPTY : return "LFS_ERR_NOTEMPTY";
|
||||
case LFS_ERR_BADF : return "LFS_ERR_BADF";
|
||||
case LFS_ERR_INVAL : return "LFS_ERR_INVAL";
|
||||
case LFS_ERR_NOSPC : return "LFS_ERR_NOSPC";
|
||||
case LFS_ERR_NOMEM : return "LFS_ERR_NOMEM";
|
||||
|
||||
default:
|
||||
static char errcode[10];
|
||||
sprintf(errcode, "%ld", err);
|
||||
return errcode;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach for Adafruit Industries
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ADAFRUIT_LITTLEFS_H_
|
||||
#define ADAFRUIT_LITTLEFS_H_
|
||||
|
||||
#include <Stream.h>
|
||||
|
||||
// Internal Flash uses ARM Little FileSystem
|
||||
// https://github.com/ARMmbed/littlefs
|
||||
#include "littlefs/lfs.h"
|
||||
#include "Adafruit_LittleFS_File.h"
|
||||
//#include "rtos.h" // tied to FreeRTOS for serialization
|
||||
|
||||
class Adafruit_LittleFS
|
||||
{
|
||||
public:
|
||||
Adafruit_LittleFS (void);
|
||||
Adafruit_LittleFS (struct lfs_config* cfg);
|
||||
virtual ~Adafruit_LittleFS ();
|
||||
|
||||
bool begin(struct lfs_config * cfg = NULL);
|
||||
void end(void);
|
||||
|
||||
// Open the specified file/directory with the supplied mode (e.g. read or
|
||||
// write, etc). Returns a File object for interacting with the file.
|
||||
// Note that currently only one file can be open at a time.
|
||||
Adafruit_LittleFS_Namespace::File open (char const *filename, uint8_t mode = Adafruit_LittleFS_Namespace::FILE_O_READ);
|
||||
|
||||
// Methods to determine if the requested file path exists.
|
||||
bool exists (char const *filepath);
|
||||
|
||||
// Create the requested directory hierarchy--if intermediate directories
|
||||
// do not exist they will be created.
|
||||
bool mkdir (char const *filepath);
|
||||
|
||||
// Delete the file.
|
||||
bool remove (char const *filepath);
|
||||
|
||||
// Rename the file.
|
||||
bool rename (char const *oldfilepath, char const *newfilepath);
|
||||
|
||||
// Delete a folder (must be empty)
|
||||
bool rmdir (char const *filepath);
|
||||
|
||||
// Delete a folder (recursively)
|
||||
bool rmdir_r (char const *filepath);
|
||||
|
||||
// format file system
|
||||
bool format (void);
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
/* INTERNAL USAGE ONLY
|
||||
* Although declare as public, it is meant to be invoked by internal
|
||||
* code. User should not call these directly
|
||||
*------------------------------------------------------------------*/
|
||||
lfs_t* _getFS (void) { return &_lfs; }
|
||||
void _lockFS (void) { }//xSemaphoreTake(_mutex, portMAX_DELAY); }
|
||||
void _unlockFS(void) { }//xSemaphoreGive(_mutex); }
|
||||
|
||||
protected:
|
||||
bool _mounted;
|
||||
struct lfs_config* _lfs_cfg;
|
||||
lfs_t _lfs;
|
||||
// SemaphoreHandle_t _mutex;
|
||||
|
||||
private:
|
||||
// StaticSemaphore_t _MutexStorageSpace;
|
||||
};
|
||||
|
||||
#if !CFG_DEBUG
|
||||
#define VERIFY_LFS(...) _GET_3RD_ARG(__VA_ARGS__, VERIFY_ERR_2ARGS, VERIFY_ERR_1ARGS)(__VA_ARGS__, NULL)
|
||||
#define PRINT_LFS_ERR(_err)
|
||||
#else
|
||||
#define VERIFY_LFS(...) _GET_3RD_ARG(__VA_ARGS__, VERIFY_ERR_2ARGS, VERIFY_ERR_1ARGS)(__VA_ARGS__, dbg_strerr_lfs)
|
||||
#define PRINT_LFS_ERR(_err) do { if (_err) { VERIFY_MESS((long int)_err, dbg_strerr_lfs); } } while(0) // LFS_ERR are of type int, VERIFY_MESS expects long_int
|
||||
|
||||
const char* dbg_strerr_lfs (int32_t err);
|
||||
#endif
|
||||
|
||||
#endif /* ADAFRUIT_LITTLEFS_H_ */
|
||||
@@ -0,0 +1,420 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach for Adafruit Industries
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "Adafruit_LittleFS.h"
|
||||
#include "littlefs/lfs.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
using namespace Adafruit_LittleFS_Namespace;
|
||||
|
||||
File::File (Adafruit_LittleFS &fs)
|
||||
{
|
||||
_fs = &fs;
|
||||
_is_dir = false;
|
||||
_name[0] = 0;
|
||||
_name[LFS_NAME_MAX] = 0;
|
||||
_dir_path = NULL;
|
||||
|
||||
_dir = NULL;
|
||||
_file = NULL;
|
||||
}
|
||||
|
||||
File::File (char const *filename, uint8_t mode, Adafruit_LittleFS &fs)
|
||||
: File(fs)
|
||||
{
|
||||
// public constructor calls public API open(), which will obtain the mutex
|
||||
this->open(filename, mode);
|
||||
}
|
||||
|
||||
bool File::_open_file (char const *filepath, uint8_t mode)
|
||||
{
|
||||
int flags = (mode == FILE_O_READ) ? LFS_O_RDONLY :
|
||||
(mode == FILE_O_WRITE) ? (LFS_O_RDWR | LFS_O_CREAT) : 0;
|
||||
|
||||
if ( flags )
|
||||
{
|
||||
_file = (lfs_file_t*) malloc(sizeof(lfs_file_t));
|
||||
if (!_file) return false;
|
||||
|
||||
int rc = lfs_file_open(_fs->_getFS(), _file, filepath, flags);
|
||||
|
||||
if ( rc )
|
||||
{
|
||||
// failed to open
|
||||
PRINT_LFS_ERR(rc);
|
||||
// free memory
|
||||
free(_file);
|
||||
_file = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
// move to end of file
|
||||
if ( mode == FILE_O_WRITE ) lfs_file_seek(_fs->_getFS(), _file, 0, LFS_SEEK_END);
|
||||
|
||||
_is_dir = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool File::_open_dir (char const *filepath)
|
||||
{
|
||||
_dir = (lfs_dir_t*) malloc(sizeof(lfs_dir_t));
|
||||
if (!_dir) return false;
|
||||
|
||||
int rc = lfs_dir_open(_fs->_getFS(), _dir, filepath);
|
||||
|
||||
if ( rc )
|
||||
{
|
||||
// failed to open
|
||||
PRINT_LFS_ERR(rc);
|
||||
// free memory
|
||||
free(_dir);
|
||||
_dir = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
_is_dir = true;
|
||||
|
||||
_dir_path = (char*) malloc(strlen(filepath) + 1);
|
||||
strcpy(_dir_path, filepath);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool File::open (char const *filepath, uint8_t mode)
|
||||
{
|
||||
bool ret = false;
|
||||
_fs->_lockFS();
|
||||
|
||||
ret = this->_open(filepath, mode);
|
||||
|
||||
_fs->_unlockFS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool File::_open (char const *filepath, uint8_t mode)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
// close if currently opened
|
||||
if ( this->isOpen() ) _close();
|
||||
|
||||
struct lfs_info info;
|
||||
int rc = lfs_stat(_fs->_getFS(), filepath, &info);
|
||||
|
||||
if ( LFS_ERR_OK == rc )
|
||||
{
|
||||
// file existed, open file or directory accordingly
|
||||
ret = (info.type == LFS_TYPE_REG) ? _open_file(filepath, mode) : _open_dir(filepath);
|
||||
}
|
||||
else if ( LFS_ERR_NOENT == rc )
|
||||
{
|
||||
// file not existed, only proceed with FILE_O_WRITE mode
|
||||
if ( mode == FILE_O_WRITE ) ret = _open_file(filepath, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
PRINT_LFS_ERR(rc);
|
||||
}
|
||||
|
||||
// save bare file name
|
||||
if (ret)
|
||||
{
|
||||
char const* splash = strrchr(filepath, '/');
|
||||
strncpy(_name, splash ? (splash + 1) : filepath, LFS_NAME_MAX);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t File::write (uint8_t ch)
|
||||
{
|
||||
return write(&ch, 1);
|
||||
}
|
||||
|
||||
size_t File::write (uint8_t const *buf, size_t size)
|
||||
{
|
||||
lfs_ssize_t wrcount = 0;
|
||||
_fs->_lockFS();
|
||||
|
||||
if (!this->_is_dir)
|
||||
{
|
||||
wrcount = lfs_file_write(_fs->_getFS(), _file, buf, size);
|
||||
if (wrcount < 0)
|
||||
{
|
||||
wrcount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
_fs->_unlockFS();
|
||||
return wrcount;
|
||||
}
|
||||
|
||||
int File::read (void)
|
||||
{
|
||||
// this thin wrapper relies on called function to synchronize
|
||||
int ret = -1;
|
||||
uint8_t ch;
|
||||
if (read(&ch, 1) > 0)
|
||||
{
|
||||
ret = static_cast<int>(ch);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int File::read (void *buf, uint16_t nbyte)
|
||||
{
|
||||
int ret = 0;
|
||||
_fs->_lockFS();
|
||||
|
||||
if (!this->_is_dir)
|
||||
{
|
||||
ret = lfs_file_read(_fs->_getFS(), _file, buf, nbyte);
|
||||
}
|
||||
|
||||
_fs->_unlockFS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int File::peek (void)
|
||||
{
|
||||
int ret = -1;
|
||||
_fs->_lockFS();
|
||||
|
||||
if (!this->_is_dir)
|
||||
{
|
||||
uint32_t pos = lfs_file_tell(_fs->_getFS(), _file);
|
||||
uint8_t ch = 0;
|
||||
if (lfs_file_read(_fs->_getFS(), _file, &ch, 1) > 0)
|
||||
{
|
||||
ret = static_cast<int>(ch);
|
||||
}
|
||||
(void) lfs_file_seek(_fs->_getFS(), _file, pos, LFS_SEEK_SET);
|
||||
}
|
||||
|
||||
_fs->_unlockFS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
int File::available (void)
|
||||
{
|
||||
int ret = 0;
|
||||
_fs->_lockFS();
|
||||
|
||||
if (!this->_is_dir)
|
||||
{
|
||||
uint32_t size = lfs_file_size(_fs->_getFS(), _file);
|
||||
uint32_t pos = lfs_file_tell(_fs->_getFS(), _file);
|
||||
ret = size - pos;
|
||||
}
|
||||
|
||||
_fs->_unlockFS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool File::seek (uint32_t pos)
|
||||
{
|
||||
bool ret = false;
|
||||
_fs->_lockFS();
|
||||
|
||||
if (!this->_is_dir)
|
||||
{
|
||||
ret = lfs_file_seek(_fs->_getFS(), _file, pos, LFS_SEEK_SET) >= 0;
|
||||
}
|
||||
|
||||
_fs->_unlockFS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t File::position (void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
_fs->_lockFS();
|
||||
|
||||
if (!this->_is_dir)
|
||||
{
|
||||
ret = lfs_file_tell(_fs->_getFS(), _file);
|
||||
}
|
||||
|
||||
_fs->_unlockFS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t File::size (void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
_fs->_lockFS();
|
||||
|
||||
if (!this->_is_dir)
|
||||
{
|
||||
ret = lfs_file_size(_fs->_getFS(), _file);
|
||||
}
|
||||
|
||||
_fs->_unlockFS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool File::truncate (uint32_t pos)
|
||||
{
|
||||
int32_t ret=LFS_ERR_ISDIR;
|
||||
_fs->_lockFS();
|
||||
if (!this->_is_dir)
|
||||
{
|
||||
ret = lfs_file_truncate(_fs->_getFS(), _file, pos);
|
||||
}
|
||||
_fs->_unlockFS();
|
||||
return ( ret == 0 );
|
||||
}
|
||||
|
||||
bool File::truncate (void)
|
||||
{
|
||||
int32_t ret=LFS_ERR_ISDIR;
|
||||
uint32_t pos;
|
||||
_fs->_lockFS();
|
||||
if (!this->_is_dir)
|
||||
{
|
||||
pos = lfs_file_tell(_fs->_getFS(), _file);
|
||||
ret = lfs_file_truncate(_fs->_getFS(), _file, pos);
|
||||
}
|
||||
_fs->_unlockFS();
|
||||
return ( ret == 0 );
|
||||
}
|
||||
|
||||
void File::flush (void)
|
||||
{
|
||||
_fs->_lockFS();
|
||||
|
||||
if (!this->_is_dir)
|
||||
{
|
||||
lfs_file_sync(_fs->_getFS(), _file);
|
||||
}
|
||||
|
||||
_fs->_unlockFS();
|
||||
return;
|
||||
}
|
||||
|
||||
void File::close (void)
|
||||
{
|
||||
_fs->_lockFS();
|
||||
this->_close();
|
||||
_fs->_unlockFS();
|
||||
}
|
||||
|
||||
void File::_close(void)
|
||||
{
|
||||
if ( this->isOpen() )
|
||||
{
|
||||
if ( this->_is_dir )
|
||||
{
|
||||
lfs_dir_close(_fs->_getFS(), _dir);
|
||||
free(_dir);
|
||||
_dir = NULL;
|
||||
|
||||
if ( this->_dir_path ) free(_dir_path);
|
||||
_dir_path = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
lfs_file_close(this->_fs->_getFS(), _file);
|
||||
free(_file);
|
||||
_file = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File::operator bool (void)
|
||||
{
|
||||
return isOpen();
|
||||
}
|
||||
|
||||
bool File::isOpen(void)
|
||||
{
|
||||
return (_file != NULL) || (_dir != NULL);
|
||||
}
|
||||
|
||||
// WARNING -- although marked as `const`, the values pointed
|
||||
// to may change. For example, if the same File
|
||||
// object has `open()` called with a different
|
||||
// file or directory name, this same pointer will
|
||||
// suddenly (unexpectedly?) have different values.
|
||||
char const* File::name (void)
|
||||
{
|
||||
return this->_name;
|
||||
}
|
||||
|
||||
bool File::isDirectory (void)
|
||||
{
|
||||
return this->_is_dir;
|
||||
}
|
||||
|
||||
File File::openNextFile (uint8_t mode)
|
||||
{
|
||||
_fs->_lockFS();
|
||||
|
||||
File ret(*_fs);
|
||||
if (this->_is_dir)
|
||||
{
|
||||
struct lfs_info info;
|
||||
int rc;
|
||||
|
||||
// lfs_dir_read returns 0 when reaching end of directory, 1 if found an entry
|
||||
// Skip the "." and ".." entries ...
|
||||
do
|
||||
{
|
||||
rc = lfs_dir_read(_fs->_getFS(), _dir, &info);
|
||||
} while ( rc == 1 && (!strcmp(".", info.name) || !strcmp("..", info.name)) );
|
||||
|
||||
if ( rc == 1 )
|
||||
{
|
||||
// string cat name with current folder
|
||||
char filepath[strlen(_dir_path) + 1 + strlen(info.name) + 1]; // potential for significant stack usage
|
||||
strcpy(filepath, _dir_path);
|
||||
if ( !(_dir_path[0] == '/' && _dir_path[1] == 0) ) strcat(filepath, "/"); // only add '/' if cwd is not root
|
||||
strcat(filepath, info.name);
|
||||
|
||||
(void)ret._open(filepath, mode); // return value is ignored ... caller is expected to check isOpened()
|
||||
}
|
||||
else if ( rc < 0 )
|
||||
{
|
||||
PRINT_LFS_ERR(rc);
|
||||
}
|
||||
}
|
||||
_fs->_unlockFS();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void File::rewindDirectory (void)
|
||||
{
|
||||
_fs->_lockFS();
|
||||
if (this->_is_dir)
|
||||
{
|
||||
lfs_dir_rewind(_fs->_getFS(), _dir);
|
||||
}
|
||||
_fs->_unlockFS();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach for Adafruit Industries
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ADAFRUIT_LITTLEFS_FILE_H_
|
||||
#define ADAFRUIT_LITTLEFS_FILE_H_
|
||||
|
||||
// Forward declaration
|
||||
class Adafruit_LittleFS;
|
||||
|
||||
namespace Adafruit_LittleFS_Namespace
|
||||
{
|
||||
|
||||
// avoid conflict with other FileSystem FILE_READ/FILE_WRITE
|
||||
enum
|
||||
{
|
||||
FILE_O_READ = 0,
|
||||
FILE_O_WRITE = 1,
|
||||
};
|
||||
|
||||
class File : public Stream
|
||||
{
|
||||
public:
|
||||
File (Adafruit_LittleFS &fs);
|
||||
File (char const *filename, uint8_t mode, Adafruit_LittleFS &fs);
|
||||
|
||||
public:
|
||||
|
||||
bool open (char const *filename, uint8_t mode);
|
||||
|
||||
//------------- Stream API -------------//
|
||||
virtual size_t write (uint8_t ch);
|
||||
virtual size_t write (uint8_t const *buf, size_t size);
|
||||
size_t write(const char *str) {
|
||||
if (str == NULL) return 0;
|
||||
return write((const uint8_t *)str, strlen(str));
|
||||
}
|
||||
size_t write(const char *buffer, size_t size) {
|
||||
return write((const uint8_t *)buffer, size);
|
||||
}
|
||||
|
||||
virtual int read (void);
|
||||
int read (void *buf, uint16_t nbyte);
|
||||
|
||||
virtual int peek (void);
|
||||
virtual int available (void);
|
||||
virtual void flush (void);
|
||||
|
||||
bool seek (uint32_t pos);
|
||||
uint32_t position (void);
|
||||
uint32_t size (void);
|
||||
|
||||
bool truncate (uint32_t pos);
|
||||
bool truncate (void);
|
||||
|
||||
void close (void);
|
||||
|
||||
operator bool (void);
|
||||
|
||||
bool isOpen(void);
|
||||
char const* name (void);
|
||||
|
||||
bool isDirectory (void);
|
||||
File openNextFile (uint8_t mode = FILE_O_READ);
|
||||
void rewindDirectory (void);
|
||||
|
||||
private:
|
||||
Adafruit_LittleFS* _fs;
|
||||
|
||||
bool _is_dir;
|
||||
|
||||
union {
|
||||
lfs_file_t* _file;
|
||||
lfs_dir_t* _dir;
|
||||
};
|
||||
|
||||
char* _dir_path;
|
||||
char _name[LFS_NAME_MAX+1];
|
||||
|
||||
bool _open(char const *filepath, uint8_t mode);
|
||||
bool _open_file(char const *filepath, uint8_t mode);
|
||||
bool _open_dir (char const *filepath);
|
||||
void _close(void);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* ADAFRUIT_LITTLEFS_FILE_H_ */
|
||||
@@ -0,0 +1,24 @@
|
||||
Copyright (c) 2017, Arm Limited. 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.
|
||||
- Neither the name of ARM nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
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.
|
||||
@@ -0,0 +1,177 @@
|
||||
## The little filesystem
|
||||
|
||||
A little fail-safe filesystem designed for embedded systems.
|
||||
|
||||
```
|
||||
| | | .---._____
|
||||
.-----. | |
|
||||
--|o |---| littlefs |
|
||||
--| |---| |
|
||||
'-----' '----------'
|
||||
| | |
|
||||
```
|
||||
|
||||
**Bounded RAM/ROM** - The littlefs is designed to work with a limited amount
|
||||
of memory. Recursion is avoided and dynamic memory is limited to configurable
|
||||
buffers that can be provided statically.
|
||||
|
||||
**Power-loss resilient** - The littlefs is designed for systems that may have
|
||||
random power failures. The littlefs has strong copy-on-write guarantees and
|
||||
storage on disk is always kept in a valid state.
|
||||
|
||||
**Wear leveling** - Since the most common form of embedded storage is erodible
|
||||
flash memories, littlefs provides a form of dynamic wear leveling for systems
|
||||
that can not fit a full flash translation layer.
|
||||
|
||||
## Example
|
||||
|
||||
Here's a simple example that updates a file named `boot_count` every time
|
||||
main runs. The program can be interrupted at any time without losing track
|
||||
of how many times it has been booted and without corrupting the filesystem:
|
||||
|
||||
``` c
|
||||
#include "lfs.h"
|
||||
|
||||
// variables used by the filesystem
|
||||
lfs_t lfs;
|
||||
lfs_file_t file;
|
||||
|
||||
// configuration of the filesystem is provided by this struct
|
||||
const struct lfs_config cfg = {
|
||||
// block device operations
|
||||
.read = user_provided_block_device_read,
|
||||
.prog = user_provided_block_device_prog,
|
||||
.erase = user_provided_block_device_erase,
|
||||
.sync = user_provided_block_device_sync,
|
||||
|
||||
// block device configuration
|
||||
.read_size = 16,
|
||||
.prog_size = 16,
|
||||
.block_size = 4096,
|
||||
.block_count = 128,
|
||||
.lookahead = 128,
|
||||
};
|
||||
|
||||
// entry point
|
||||
int main(void) {
|
||||
// mount the filesystem
|
||||
int err = lfs_mount(&lfs, &cfg);
|
||||
|
||||
// reformat if we can't mount the filesystem
|
||||
// this should only happen on the first boot
|
||||
if (err) {
|
||||
lfs_format(&lfs, &cfg);
|
||||
lfs_mount(&lfs, &cfg);
|
||||
}
|
||||
|
||||
// read current count
|
||||
uint32_t boot_count = 0;
|
||||
lfs_file_open(&lfs, &file, "boot_count", LFS_O_RDWR | LFS_O_CREAT);
|
||||
lfs_file_read(&lfs, &file, &boot_count, sizeof(boot_count));
|
||||
|
||||
// update boot count
|
||||
boot_count += 1;
|
||||
lfs_file_rewind(&lfs, &file);
|
||||
lfs_file_write(&lfs, &file, &boot_count, sizeof(boot_count));
|
||||
|
||||
// remember the storage is not updated until the file is closed successfully
|
||||
lfs_file_close(&lfs, &file);
|
||||
|
||||
// release any resources we were using
|
||||
lfs_unmount(&lfs);
|
||||
|
||||
// print the boot count
|
||||
printf("boot_count: %d\n", boot_count);
|
||||
}
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Detailed documentation (or at least as much detail as is currently available)
|
||||
can be found in the comments in [lfs.h](lfs.h).
|
||||
|
||||
As you may have noticed, littlefs takes in a configuration structure that
|
||||
defines how the filesystem operates. The configuration struct provides the
|
||||
filesystem with the block device operations and dimensions, tweakable
|
||||
parameters that tradeoff memory usage for performance, and optional
|
||||
static buffers if the user wants to avoid dynamic memory.
|
||||
|
||||
The state of the littlefs is stored in the `lfs_t` type which is left up
|
||||
to the user to allocate, allowing multiple filesystems to be in use
|
||||
simultaneously. With the `lfs_t` and configuration struct, a user can
|
||||
format a block device or mount the filesystem.
|
||||
|
||||
Once mounted, the littlefs provides a full set of POSIX-like file and
|
||||
directory functions, with the deviation that the allocation of filesystem
|
||||
structures must be provided by the user.
|
||||
|
||||
All POSIX operations, such as remove and rename, are atomic, even in event
|
||||
of power-loss. Additionally, no file updates are actually committed to the
|
||||
filesystem until sync or close is called on the file.
|
||||
|
||||
## Other notes
|
||||
|
||||
All littlefs have the potential to return a negative error code. The errors
|
||||
can be either one of those found in the `enum lfs_error` in [lfs.h](lfs.h),
|
||||
or an error returned by the user's block device operations.
|
||||
|
||||
In the configuration struct, the `prog` and `erase` function provided by the
|
||||
user may return a `LFS_ERR_CORRUPT` error if the implementation already can
|
||||
detect corrupt blocks. However, the wear leveling does not depend on the return
|
||||
code of these functions, instead all data is read back and checked for
|
||||
integrity.
|
||||
|
||||
If your storage caches writes, make sure that the provided `sync` function
|
||||
flushes all the data to memory and ensures that the next read fetches the data
|
||||
from memory, otherwise data integrity can not be guaranteed. If the `write`
|
||||
function does not perform caching, and therefore each `read` or `write` call
|
||||
hits the memory, the `sync` function can simply return 0.
|
||||
|
||||
## Reference material
|
||||
|
||||
[DESIGN.md](DESIGN.md) - DESIGN.md contains a fully detailed dive into how
|
||||
littlefs actually works. I would encourage you to read it since the
|
||||
solutions and tradeoffs at work here are quite interesting.
|
||||
|
||||
[SPEC.md](SPEC.md) - SPEC.md contains the on-disk specification of littlefs
|
||||
with all the nitty-gritty details. Can be useful for developing tooling.
|
||||
|
||||
## Testing
|
||||
|
||||
The littlefs comes with a test suite designed to run on a PC using the
|
||||
[emulated block device](emubd/lfs_emubd.h) found in the emubd directory.
|
||||
The tests assume a Linux environment and can be started with make:
|
||||
|
||||
``` bash
|
||||
make test
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
The littlefs is provided under the [BSD-3-Clause](https://spdx.org/licenses/BSD-3-Clause.html)
|
||||
license. See [LICENSE.md](LICENSE.md) for more information. Contributions to
|
||||
this project are accepted under the same license.
|
||||
|
||||
Individual files contain the following tag instead of the full license text.
|
||||
|
||||
SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
This enables machine processing of license information based on the SPDX
|
||||
License Identifiers that are here available: http://spdx.org/licenses/
|
||||
|
||||
## Related projects
|
||||
|
||||
[Mbed OS](https://github.com/ARMmbed/mbed-os/tree/master/features/filesystem/littlefs) -
|
||||
The easiest way to get started with littlefs is to jump into [Mbed](https://os.mbed.com/),
|
||||
which already has block device drivers for most forms of embedded storage. The
|
||||
littlefs is available in Mbed OS as the [LittleFileSystem](https://os.mbed.com/docs/latest/reference/littlefilesystem.html)
|
||||
class.
|
||||
|
||||
[littlefs-fuse](https://github.com/geky/littlefs-fuse) - A [FUSE](https://github.com/libfuse/libfuse)
|
||||
wrapper for littlefs. The project allows you to mount littlefs directly on a
|
||||
Linux machine. Can be useful for debugging littlefs if you have an SD card
|
||||
handy.
|
||||
|
||||
[littlefs-js](https://github.com/geky/littlefs-js) - A javascript wrapper for
|
||||
littlefs. I'm not sure why you would want this, but it is handy for demos.
|
||||
You can see it in action [here](http://littlefs.geky.net/demo.html).
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,501 @@
|
||||
/*
|
||||
* The little filesystem
|
||||
*
|
||||
* Copyright (c) 2017, Arm Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef LFS_H
|
||||
#define LFS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
/// Version info ///
|
||||
|
||||
// Software library version
|
||||
// Major (top-nibble), incremented on backwards incompatible changes
|
||||
// Minor (bottom-nibble), incremented on feature additions
|
||||
#define LFS_VERSION 0x00010007
|
||||
#define LFS_VERSION_MAJOR (0xffff & (LFS_VERSION >> 16))
|
||||
#define LFS_VERSION_MINOR (0xffff & (LFS_VERSION >> 0))
|
||||
|
||||
// Version of On-disk data structures
|
||||
// Major (top-nibble), incremented on backwards incompatible changes
|
||||
// Minor (bottom-nibble), incremented on feature additions
|
||||
#define LFS_DISK_VERSION 0x00010001
|
||||
#define LFS_DISK_VERSION_MAJOR (0xffff & (LFS_DISK_VERSION >> 16))
|
||||
#define LFS_DISK_VERSION_MINOR (0xffff & (LFS_DISK_VERSION >> 0))
|
||||
|
||||
|
||||
/// Definitions ///
|
||||
|
||||
// Type definitions
|
||||
typedef uint32_t lfs_size_t;
|
||||
typedef uint32_t lfs_off_t;
|
||||
|
||||
typedef int32_t lfs_ssize_t;
|
||||
typedef int32_t lfs_soff_t;
|
||||
|
||||
typedef uint32_t lfs_block_t;
|
||||
|
||||
// Max name size in bytes
|
||||
#ifndef LFS_NAME_MAX
|
||||
#define LFS_NAME_MAX 255
|
||||
#endif
|
||||
|
||||
// Max file size in bytes
|
||||
#ifndef LFS_FILE_MAX
|
||||
#define LFS_FILE_MAX 2147483647
|
||||
#endif
|
||||
|
||||
// Possible error codes, these are negative to allow
|
||||
// valid positive return values
|
||||
enum lfs_error {
|
||||
LFS_ERR_OK = 0, // No error
|
||||
LFS_ERR_IO = -5, // Error during device operation
|
||||
LFS_ERR_CORRUPT = -52, // Corrupted
|
||||
LFS_ERR_NOENT = -2, // No directory entry
|
||||
LFS_ERR_EXIST = -17, // Entry already exists
|
||||
LFS_ERR_NOTDIR = -20, // Entry is not a dir
|
||||
LFS_ERR_ISDIR = -21, // Entry is a dir
|
||||
LFS_ERR_NOTEMPTY = -39, // Dir is not empty
|
||||
LFS_ERR_BADF = -9, // Bad file number
|
||||
LFS_ERR_FBIG = -27, // File too large
|
||||
LFS_ERR_INVAL = -22, // Invalid parameter
|
||||
LFS_ERR_NOSPC = -28, // No space left on device
|
||||
LFS_ERR_NOMEM = -12, // No more memory available
|
||||
};
|
||||
|
||||
// File types
|
||||
enum lfs_type {
|
||||
LFS_TYPE_REG = 0x11,
|
||||
LFS_TYPE_DIR = 0x22,
|
||||
LFS_TYPE_SUPERBLOCK = 0x2e,
|
||||
};
|
||||
|
||||
// File open flags
|
||||
enum lfs_open_flags {
|
||||
// open flags
|
||||
LFS_O_RDONLY = 1, // Open a file as read only
|
||||
LFS_O_WRONLY = 2, // Open a file as write only
|
||||
LFS_O_RDWR = 3, // Open a file as read and write
|
||||
LFS_O_CREAT = 0x0100, // Create a file if it does not exist
|
||||
LFS_O_EXCL = 0x0200, // Fail if a file already exists
|
||||
LFS_O_TRUNC = 0x0400, // Truncate the existing file to zero size
|
||||
LFS_O_APPEND = 0x0800, // Move to end of file on every write
|
||||
|
||||
// internally used flags
|
||||
LFS_F_DIRTY = 0x10000, // File does not match storage
|
||||
LFS_F_WRITING = 0x20000, // File has been written since last flush
|
||||
LFS_F_READING = 0x40000, // File has been read since last flush
|
||||
LFS_F_ERRED = 0x80000, // An error occured during write
|
||||
};
|
||||
|
||||
// File seek flags
|
||||
enum lfs_whence_flags {
|
||||
LFS_SEEK_SET = 0, // Seek relative to an absolute position
|
||||
LFS_SEEK_CUR = 1, // Seek relative to the current file position
|
||||
LFS_SEEK_END = 2, // Seek relative to the end of the file
|
||||
};
|
||||
|
||||
|
||||
// Configuration provided during initialization of the littlefs
|
||||
struct lfs_config {
|
||||
// Opaque user provided context that can be used to pass
|
||||
// information to the block device operations
|
||||
void *context;
|
||||
|
||||
// Read a region in a block. Negative error codes are propogated
|
||||
// to the user.
|
||||
int (*read)(const struct lfs_config *c, lfs_block_t block,
|
||||
lfs_off_t off, void *buffer, lfs_size_t size);
|
||||
|
||||
// Program a region in a block. The block must have previously
|
||||
// been erased. Negative error codes are propogated to the user.
|
||||
// May return LFS_ERR_CORRUPT if the block should be considered bad.
|
||||
int (*prog)(const struct lfs_config *c, lfs_block_t block,
|
||||
lfs_off_t off, const void *buffer, lfs_size_t size);
|
||||
|
||||
// Erase a block. A block must be erased before being programmed.
|
||||
// The state of an erased block is undefined. Negative error codes
|
||||
// are propogated to the user.
|
||||
// May return LFS_ERR_CORRUPT if the block should be considered bad.
|
||||
int (*erase)(const struct lfs_config *c, lfs_block_t block);
|
||||
|
||||
// Sync the state of the underlying block device. Negative error codes
|
||||
// are propogated to the user.
|
||||
int (*sync)(const struct lfs_config *c);
|
||||
|
||||
// Minimum size of a block read. This determines the size of read buffers.
|
||||
// This may be larger than the physical read size to improve performance
|
||||
// by caching more of the block device.
|
||||
lfs_size_t read_size;
|
||||
|
||||
// Minimum size of a block program. This determines the size of program
|
||||
// buffers. This may be larger than the physical program size to improve
|
||||
// performance by caching more of the block device.
|
||||
// Must be a multiple of the read size.
|
||||
lfs_size_t prog_size;
|
||||
|
||||
// Size of an erasable block. This does not impact ram consumption and
|
||||
// may be larger than the physical erase size. However, this should be
|
||||
// kept small as each file currently takes up an entire block.
|
||||
// Must be a multiple of the program size.
|
||||
lfs_size_t block_size;
|
||||
|
||||
// Number of erasable blocks on the device.
|
||||
lfs_size_t block_count;
|
||||
|
||||
// Number of blocks to lookahead during block allocation. A larger
|
||||
// lookahead reduces the number of passes required to allocate a block.
|
||||
// The lookahead buffer requires only 1 bit per block so it can be quite
|
||||
// large with little ram impact. Should be a multiple of 32.
|
||||
lfs_size_t lookahead;
|
||||
|
||||
// Optional, statically allocated read buffer. Must be read sized.
|
||||
void *read_buffer;
|
||||
|
||||
// Optional, statically allocated program buffer. Must be program sized.
|
||||
void *prog_buffer;
|
||||
|
||||
// Optional, statically allocated lookahead buffer. Must be 1 bit per
|
||||
// lookahead block.
|
||||
void *lookahead_buffer;
|
||||
|
||||
// Optional, statically allocated buffer for files. Must be program sized.
|
||||
// If enabled, only one file may be opened at a time.
|
||||
void *file_buffer;
|
||||
};
|
||||
|
||||
// Optional configuration provided during lfs_file_opencfg
|
||||
struct lfs_file_config {
|
||||
// Optional, statically allocated buffer for files. Must be program sized.
|
||||
// If NULL, malloc will be used by default.
|
||||
void *buffer;
|
||||
};
|
||||
|
||||
// File info structure
|
||||
struct lfs_info {
|
||||
// Type of the file, either LFS_TYPE_REG or LFS_TYPE_DIR
|
||||
uint8_t type;
|
||||
|
||||
// Size of the file, only valid for REG files
|
||||
lfs_size_t size;
|
||||
|
||||
// Name of the file stored as a null-terminated string
|
||||
char name[LFS_NAME_MAX+1];
|
||||
};
|
||||
|
||||
|
||||
/// littlefs data structures ///
|
||||
typedef struct lfs_entry {
|
||||
lfs_off_t off;
|
||||
|
||||
struct lfs_disk_entry {
|
||||
uint8_t type;
|
||||
uint8_t elen;
|
||||
uint8_t alen;
|
||||
uint8_t nlen;
|
||||
union {
|
||||
struct {
|
||||
lfs_block_t head;
|
||||
lfs_size_t size;
|
||||
} file;
|
||||
lfs_block_t dir[2];
|
||||
} u;
|
||||
} d;
|
||||
} lfs_entry_t;
|
||||
|
||||
typedef struct lfs_cache {
|
||||
lfs_block_t block;
|
||||
lfs_off_t off;
|
||||
uint8_t *buffer;
|
||||
} lfs_cache_t;
|
||||
|
||||
typedef struct lfs_file {
|
||||
struct lfs_file *next;
|
||||
lfs_block_t pair[2];
|
||||
lfs_off_t poff;
|
||||
|
||||
lfs_block_t head;
|
||||
lfs_size_t size;
|
||||
|
||||
const struct lfs_file_config *cfg;
|
||||
uint32_t flags;
|
||||
lfs_off_t pos;
|
||||
lfs_block_t block;
|
||||
lfs_off_t off;
|
||||
lfs_cache_t cache;
|
||||
} lfs_file_t;
|
||||
|
||||
typedef struct lfs_dir {
|
||||
struct lfs_dir *next;
|
||||
lfs_block_t pair[2];
|
||||
lfs_off_t off;
|
||||
|
||||
lfs_block_t head[2];
|
||||
lfs_off_t pos;
|
||||
|
||||
struct lfs_disk_dir {
|
||||
uint32_t rev;
|
||||
lfs_size_t size;
|
||||
lfs_block_t tail[2];
|
||||
} d;
|
||||
} lfs_dir_t;
|
||||
|
||||
typedef struct lfs_superblock {
|
||||
lfs_off_t off;
|
||||
|
||||
struct lfs_disk_superblock {
|
||||
uint8_t type;
|
||||
uint8_t elen;
|
||||
uint8_t alen;
|
||||
uint8_t nlen;
|
||||
lfs_block_t root[2];
|
||||
uint32_t block_size;
|
||||
uint32_t block_count;
|
||||
uint32_t version;
|
||||
char magic[8];
|
||||
} d;
|
||||
} lfs_superblock_t;
|
||||
|
||||
typedef struct lfs_free {
|
||||
lfs_block_t off;
|
||||
lfs_block_t size;
|
||||
lfs_block_t i;
|
||||
lfs_block_t ack;
|
||||
uint32_t *buffer;
|
||||
} lfs_free_t;
|
||||
|
||||
// The littlefs type
|
||||
typedef struct lfs {
|
||||
const struct lfs_config *cfg;
|
||||
|
||||
lfs_block_t root[2];
|
||||
lfs_file_t *files;
|
||||
lfs_dir_t *dirs;
|
||||
|
||||
lfs_cache_t rcache;
|
||||
lfs_cache_t pcache;
|
||||
|
||||
lfs_free_t free;
|
||||
bool deorphaned;
|
||||
bool moving;
|
||||
} lfs_t;
|
||||
|
||||
|
||||
/// Filesystem functions ///
|
||||
|
||||
// Format a block device with the littlefs
|
||||
//
|
||||
// Requires a littlefs object and config struct. This clobbers the littlefs
|
||||
// object, and does not leave the filesystem mounted. The config struct must
|
||||
// be zeroed for defaults and backwards compatibility.
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_format(lfs_t *lfs, const struct lfs_config *config);
|
||||
|
||||
// Mounts a littlefs
|
||||
//
|
||||
// Requires a littlefs object and config struct. Multiple filesystems
|
||||
// may be mounted simultaneously with multiple littlefs objects. Both
|
||||
// lfs and config must be allocated while mounted. The config struct must
|
||||
// be zeroed for defaults and backwards compatibility.
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_mount(lfs_t *lfs, const struct lfs_config *config);
|
||||
|
||||
// Unmounts a littlefs
|
||||
//
|
||||
// Does nothing besides releasing any allocated resources.
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_unmount(lfs_t *lfs);
|
||||
|
||||
/// General operations ///
|
||||
|
||||
// Removes a file or directory
|
||||
//
|
||||
// If removing a directory, the directory must be empty.
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_remove(lfs_t *lfs, const char *path);
|
||||
|
||||
// Rename or move a file or directory
|
||||
//
|
||||
// If the destination exists, it must match the source in type.
|
||||
// If the destination is a directory, the directory must be empty.
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath);
|
||||
|
||||
// Find info about a file or directory
|
||||
//
|
||||
// Fills out the info structure, based on the specified file or directory.
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_stat(lfs_t *lfs, const char *path, struct lfs_info *info);
|
||||
|
||||
|
||||
/// File operations ///
|
||||
|
||||
// Open a file
|
||||
//
|
||||
// The mode that the file is opened in is determined by the flags, which
|
||||
// are values from the enum lfs_open_flags that are bitwise-ored together.
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_file_open(lfs_t *lfs, lfs_file_t *file,
|
||||
const char *path, int flags);
|
||||
|
||||
// Open a file with extra configuration
|
||||
//
|
||||
// The mode that the file is opened in is determined by the flags, which
|
||||
// are values from the enum lfs_open_flags that are bitwise-ored together.
|
||||
//
|
||||
// The config struct provides additional config options per file as described
|
||||
// above. The config struct must be allocated while the file is open, and the
|
||||
// config struct must be zeroed for defaults and backwards compatibility.
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file,
|
||||
const char *path, int flags,
|
||||
const struct lfs_file_config *config);
|
||||
|
||||
// Close a file
|
||||
//
|
||||
// Any pending writes are written out to storage as though
|
||||
// sync had been called and releases any allocated resources.
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_file_close(lfs_t *lfs, lfs_file_t *file);
|
||||
|
||||
// Synchronize a file on storage
|
||||
//
|
||||
// Any pending writes are written out to storage.
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_file_sync(lfs_t *lfs, lfs_file_t *file);
|
||||
|
||||
// Read data from file
|
||||
//
|
||||
// Takes a buffer and size indicating where to store the read data.
|
||||
// Returns the number of bytes read, or a negative error code on failure.
|
||||
lfs_ssize_t lfs_file_read(lfs_t *lfs, lfs_file_t *file,
|
||||
void *buffer, lfs_size_t size);
|
||||
|
||||
// Write data to file
|
||||
//
|
||||
// Takes a buffer and size indicating the data to write. The file will not
|
||||
// actually be updated on the storage until either sync or close is called.
|
||||
//
|
||||
// Returns the number of bytes written, or a negative error code on failure.
|
||||
lfs_ssize_t lfs_file_write(lfs_t *lfs, lfs_file_t *file,
|
||||
const void *buffer, lfs_size_t size);
|
||||
|
||||
// Change the position of the file
|
||||
//
|
||||
// The change in position is determined by the offset and whence flag.
|
||||
// Returns the old position of the file, or a negative error code on failure.
|
||||
lfs_soff_t lfs_file_seek(lfs_t *lfs, lfs_file_t *file,
|
||||
lfs_soff_t off, int whence);
|
||||
|
||||
// Truncates the size of the file to the specified size
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size);
|
||||
|
||||
// Return the position of the file
|
||||
//
|
||||
// Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR)
|
||||
// Returns the position of the file, or a negative error code on failure.
|
||||
lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file);
|
||||
|
||||
// Change the position of the file to the beginning of the file
|
||||
//
|
||||
// Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR)
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_file_rewind(lfs_t *lfs, lfs_file_t *file);
|
||||
|
||||
// Return the size of the file
|
||||
//
|
||||
// Similar to lfs_file_seek(lfs, file, 0, LFS_SEEK_END)
|
||||
// Returns the size of the file, or a negative error code on failure.
|
||||
lfs_soff_t lfs_file_size(lfs_t *lfs, lfs_file_t *file);
|
||||
|
||||
|
||||
/// Directory operations ///
|
||||
|
||||
// Create a directory
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_mkdir(lfs_t *lfs, const char *path);
|
||||
|
||||
// Open a directory
|
||||
//
|
||||
// Once open a directory can be used with read to iterate over files.
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_dir_open(lfs_t *lfs, lfs_dir_t *dir, const char *path);
|
||||
|
||||
// Close a directory
|
||||
//
|
||||
// Releases any allocated resources.
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_dir_close(lfs_t *lfs, lfs_dir_t *dir);
|
||||
|
||||
// Read an entry in the directory
|
||||
//
|
||||
// Fills out the info structure, based on the specified file or directory.
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_dir_read(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info);
|
||||
|
||||
// Change the position of the directory
|
||||
//
|
||||
// The new off must be a value previous returned from tell and specifies
|
||||
// an absolute offset in the directory seek.
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off);
|
||||
|
||||
// Return the position of the directory
|
||||
//
|
||||
// The returned offset is only meant to be consumed by seek and may not make
|
||||
// sense, but does indicate the current position in the directory iteration.
|
||||
//
|
||||
// Returns the position of the directory, or a negative error code on failure.
|
||||
lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir);
|
||||
|
||||
// Change the position of the directory to the beginning of the directory
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_dir_rewind(lfs_t *lfs, lfs_dir_t *dir);
|
||||
|
||||
|
||||
/// Miscellaneous littlefs specific operations ///
|
||||
|
||||
// Traverse through all blocks in use by the filesystem
|
||||
//
|
||||
// The provided callback will be called with each block address that is
|
||||
// currently in use by the filesystem. This can be used to determine which
|
||||
// blocks are in use or how much of the storage is available.
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_traverse(lfs_t *lfs, int (*cb)(void*, lfs_block_t), void *data);
|
||||
|
||||
// Prunes any recoverable errors that may have occured in the filesystem
|
||||
//
|
||||
// Not needed to be called by user unless an operation is interrupted
|
||||
// but the filesystem is still mounted. This is already called on first
|
||||
// allocation.
|
||||
//
|
||||
// Returns a negative error code on failure.
|
||||
int lfs_deorphan(lfs_t *lfs);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* lfs util functions
|
||||
*
|
||||
* Copyright (c) 2017, Arm Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#include "lfs_util.h"
|
||||
|
||||
// Only compile if user does not provide custom config
|
||||
#ifndef LFS_CONFIG
|
||||
|
||||
|
||||
// Software CRC implementation with small lookup table
|
||||
void lfs_crc(uint32_t *restrict crc, const void *buffer, size_t size) {
|
||||
static const uint32_t rtable[16] = {
|
||||
0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac,
|
||||
0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c,
|
||||
0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c,
|
||||
0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c,
|
||||
};
|
||||
|
||||
const uint8_t *data = buffer;
|
||||
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
*crc = (*crc >> 4) ^ rtable[(*crc ^ (data[i] >> 0)) & 0xf];
|
||||
*crc = (*crc >> 4) ^ rtable[(*crc ^ (data[i] >> 4)) & 0xf];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* lfs utility functions
|
||||
*
|
||||
* Copyright (c) 2017, Arm Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
#ifndef LFS_UTIL_H
|
||||
#define LFS_UTIL_H
|
||||
|
||||
// Users can override lfs_util.h with their own configuration by defining
|
||||
// LFS_CONFIG as a header file to include (-DLFS_CONFIG=lfs_config.h).
|
||||
//
|
||||
// If LFS_CONFIG is used, none of the default utils will be emitted and must be
|
||||
// provided by the config file. To start I would suggest copying lfs_util.h and
|
||||
// modifying as needed.
|
||||
#ifdef LFS_CONFIG
|
||||
#define LFS_STRINGIZE(x) LFS_STRINGIZE2(x)
|
||||
#define LFS_STRINGIZE2(x) #x
|
||||
#include LFS_STRINGIZE(LFS_CONFIG)
|
||||
#else
|
||||
|
||||
// System includes
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef LFS_NO_MALLOC
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#ifndef LFS_NO_ASSERT
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
#if !CFG_DEBUG
|
||||
#define LFS_NO_DEBUG
|
||||
#define LFS_NO_WARN
|
||||
#define LFS_NO_ERROR
|
||||
#endif
|
||||
|
||||
#if !defined(LFS_NO_DEBUG) || !defined(LFS_NO_WARN) || !defined(LFS_NO_ERROR)
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
|
||||
// Macros, may be replaced by system specific wrappers. Arguments to these
|
||||
// macros must not have side-effects as the macros can be removed for a smaller
|
||||
// code footprint
|
||||
|
||||
// Logging functions
|
||||
#ifndef LFS_NO_DEBUG
|
||||
#define LFS_DEBUG(fmt, ...) \
|
||||
printf("lfs debug:%d: " fmt "\n", __LINE__, __VA_ARGS__)
|
||||
#else
|
||||
#define LFS_DEBUG(fmt, ...)
|
||||
#endif
|
||||
|
||||
#ifndef LFS_NO_WARN
|
||||
#define LFS_WARN(fmt, ...) \
|
||||
printf("lfs warn:%d: " fmt "\n", __LINE__, __VA_ARGS__)
|
||||
#else
|
||||
#define LFS_WARN(fmt, ...)
|
||||
#endif
|
||||
|
||||
#ifndef LFS_NO_ERROR
|
||||
#define LFS_ERROR(fmt, ...) \
|
||||
printf("lfs error:%d: " fmt "\n", __LINE__, __VA_ARGS__)
|
||||
#else
|
||||
#define LFS_ERROR(fmt, ...)
|
||||
#endif
|
||||
|
||||
// Runtime assertions
|
||||
#ifndef LFS_NO_ASSERT
|
||||
#define LFS_ASSERT(test) assert(test)
|
||||
#else
|
||||
#define LFS_ASSERT(test)
|
||||
#endif
|
||||
|
||||
|
||||
// Builtin functions, these may be replaced by more efficient
|
||||
// toolchain-specific implementations. LFS_NO_INTRINSICS falls back to a more
|
||||
// expensive basic C implementation for debugging purposes
|
||||
|
||||
// Min/max functions for unsigned 32-bit numbers
|
||||
static inline uint32_t lfs_max(uint32_t a, uint32_t b) {
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
static inline uint32_t lfs_min(uint32_t a, uint32_t b) {
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
// Find the next smallest power of 2 less than or equal to a
|
||||
static inline uint32_t lfs_npw2(uint32_t a) {
|
||||
#if !defined(LFS_NO_INTRINSICS) && (defined(__GNUC__) || defined(__CC_ARM))
|
||||
return 32 - __builtin_clz(a-1);
|
||||
#else
|
||||
uint32_t r = 0;
|
||||
uint32_t s;
|
||||
a -= 1;
|
||||
s = (a > 0xffff) << 4; a >>= s; r |= s;
|
||||
s = (a > 0xff ) << 3; a >>= s; r |= s;
|
||||
s = (a > 0xf ) << 2; a >>= s; r |= s;
|
||||
s = (a > 0x3 ) << 1; a >>= s; r |= s;
|
||||
return (r | (a >> 1)) + 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Count the number of trailing binary zeros in a
|
||||
// lfs_ctz(0) may be undefined
|
||||
static inline uint32_t lfs_ctz(uint32_t a) {
|
||||
#if !defined(LFS_NO_INTRINSICS) && defined(__GNUC__)
|
||||
return __builtin_ctz(a);
|
||||
#else
|
||||
return lfs_npw2((a & -a) + 1) - 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Count the number of binary ones in a
|
||||
static inline uint32_t lfs_popc(uint32_t a) {
|
||||
#if !defined(LFS_NO_INTRINSICS) && (defined(__GNUC__) || defined(__CC_ARM))
|
||||
return __builtin_popcount(a);
|
||||
#else
|
||||
a = a - ((a >> 1) & 0x55555555);
|
||||
a = (a & 0x33333333) + ((a >> 2) & 0x33333333);
|
||||
return (((a + (a >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Find the sequence comparison of a and b, this is the distance
|
||||
// between a and b ignoring overflow
|
||||
static inline int lfs_scmp(uint32_t a, uint32_t b) {
|
||||
return (int)(unsigned)(a - b);
|
||||
}
|
||||
|
||||
// Convert from 32-bit little-endian to native order
|
||||
static inline uint32_t lfs_fromle32(uint32_t a) {
|
||||
#if !defined(LFS_NO_INTRINSICS) && ( \
|
||||
(defined( BYTE_ORDER ) && BYTE_ORDER == ORDER_LITTLE_ENDIAN ) || \
|
||||
(defined(__BYTE_ORDER ) && __BYTE_ORDER == __ORDER_LITTLE_ENDIAN ) || \
|
||||
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
|
||||
return a;
|
||||
#elif !defined(LFS_NO_INTRINSICS) && ( \
|
||||
(defined( BYTE_ORDER ) && BYTE_ORDER == ORDER_BIG_ENDIAN ) || \
|
||||
(defined(__BYTE_ORDER ) && __BYTE_ORDER == __ORDER_BIG_ENDIAN ) || \
|
||||
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
|
||||
return __builtin_bswap32(a);
|
||||
#else
|
||||
return (((uint8_t*)&a)[0] << 0) |
|
||||
(((uint8_t*)&a)[1] << 8) |
|
||||
(((uint8_t*)&a)[2] << 16) |
|
||||
(((uint8_t*)&a)[3] << 24);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Convert to 32-bit little-endian from native order
|
||||
static inline uint32_t lfs_tole32(uint32_t a) {
|
||||
return lfs_fromle32(a);
|
||||
}
|
||||
|
||||
// Calculate CRC-32 with polynomial = 0x04c11db7
|
||||
void lfs_crc(uint32_t *crc, const void *buffer, size_t size);
|
||||
|
||||
// Allocate memory, only used if buffers are not provided to littlefs
|
||||
static inline void *lfs_malloc(size_t size) {
|
||||
#ifndef LFS_NO_MALLOC
|
||||
//extern void *pvPortMalloc( size_t xWantedSize );
|
||||
//return pvPortMalloc(size);
|
||||
return malloc(size);
|
||||
#else
|
||||
(void)size;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Deallocate memory, only used if buffers are not provided to littlefs
|
||||
static inline void lfs_free(void *p) {
|
||||
#ifndef LFS_NO_MALLOC
|
||||
//extern void vPortFree( void *pv );
|
||||
//vPortFree(p);
|
||||
free(p);
|
||||
#else
|
||||
(void)p;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
Import("env")
|
||||
|
||||
# Make custom HEX from ELF
|
||||
env.AddPostAction(
|
||||
"$BUILD_DIR/${PROGNAME}.elf",
|
||||
env.VerboseAction(" ".join([
|
||||
"$OBJCOPY", "-O", "ihex", "-R", ".eeprom",
|
||||
'"$BUILD_DIR/${PROGNAME}.elf"', '"$BUILD_DIR/${PROGNAME}.hex"'
|
||||
]), "Building $BUILD_DIR/${PROGNAME}.hex")
|
||||
)
|
||||
@@ -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>tth-ltm</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>tth-x1-rpt</code></td>
|
||||
<td>XIAO nRF52840 + Wio-SX1262</td>
|
||||
<td>forwarder under test</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>tth-x4-rpt</code></td>
|
||||
<td>same</td>
|
||||
<td>paired control / radiating witness</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>tth-x2-cmp</code>, <code>tth-x3-cmp</code></td>
|
||||
<td>same</td>
|
||||
<td>probe sources</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>tth-s1-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>tth-s1-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>tth-ltm</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-dbmdefault-connection-tx-power-saved"><code>blepwr [dBm|default]</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
|
||||
tth-ltm'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,61 @@
|
||||
{
|
||||
"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",
|
||||
"openocd_target": "nrf52.cfg"
|
||||
},
|
||||
"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,73 @@
|
||||
{
|
||||
"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": "BQ nRF52840",
|
||||
"mcu": "nrf52840",
|
||||
"variant": "nano-g2-ultra",
|
||||
"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",
|
||||
"openocd_target": "nrf52.cfg"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "BQ 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://wiki.uniteng.com/en/meshtastic/nano-g2-ultra",
|
||||
"vendor": "BQ Consulting"
|
||||
}
|
||||
@@ -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,79 @@
|
||||
{
|
||||
"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",
|
||||
"openocd_target": "nrf52.cfg"
|
||||
},
|
||||
"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,33 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"variant_h": "variant_RAK3172_MODULE.h"
|
||||
},
|
||||
"core": "stm32",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DSTM32WL -DSTM32WLxx -DSTM32WLE5xx",
|
||||
"framework_extra_flags": {
|
||||
"arduino": "-DUSE_CM4_STARTUP_FILE -DARDUINO_RAK3172_MODULE"
|
||||
},
|
||||
"f_cpu": "48000000L",
|
||||
"mcu": "stm32wle5ccu",
|
||||
"product_line": "STM32WLE5xx",
|
||||
"variant": "STM32WLxx/WL54CCU_WL55CCU_WLE4C(8-B-C)U_WLE5C(8-B-C)U"
|
||||
},
|
||||
"debug": {
|
||||
"default_tools": ["stlink"],
|
||||
"jlink_device": "STM32WLE5CC",
|
||||
"openocd_target": "stm32wlx",
|
||||
"svd_path": "STM32WLE5_CM4.svd"
|
||||
},
|
||||
"frameworks": ["arduino"],
|
||||
"name": "BB-STM32WL",
|
||||
"upload": {
|
||||
"maximum_ram_size": 65536,
|
||||
"maximum_size": 262144,
|
||||
"protocol": "stlink",
|
||||
"protocols": ["stlink", "jlink"]
|
||||
},
|
||||
"url": "https://store.rakwireless.com/products/wisduo-lpwan-module-rak3172",
|
||||
"vendor": "RAK"
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "nrf52840_s140_v7.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DARDUINO_Seeed_XIAO_nRF52840 -DNRF52840_XXAA -DSEEED_XIAO_NRF52840 ",
|
||||
"f_cpu": "64000000L",
|
||||
"hwids": [
|
||||
[ "0x2886", "0x8044" ],
|
||||
[ "0x2886", "0x0044" ]
|
||||
],
|
||||
"mcu": "nrf52840",
|
||||
"variant": "Seeed_XIAO_nRF52840",
|
||||
"softdevice": {
|
||||
"sd_flags": "-DS140",
|
||||
"sd_name": "s140",
|
||||
"sd_version": "7.3.0",
|
||||
"sd_fwid": "0x0123"
|
||||
},
|
||||
"bsp": {
|
||||
"name": "adafruit"
|
||||
},
|
||||
"bootloader": {
|
||||
"settings_addr": "0xFF000"
|
||||
},
|
||||
"usb_product": "XIAO nRF52840"
|
||||
},
|
||||
"connectivity": [
|
||||
"bluetooth"
|
||||
],
|
||||
"debug": {
|
||||
"jlink_device": "nRF52840_xxAA",
|
||||
"openocd_target": "nrf52.cfg",
|
||||
"svd_path": "nrf52840.svd"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "Seeed Studio XIAO nRF52840",
|
||||
"upload": {
|
||||
"maximum_ram_size": 237568,
|
||||
"maximum_size": 811008,
|
||||
"protocol": "nrfutil",
|
||||
"speed": 115200,
|
||||
"protocols": [
|
||||
"jlink",
|
||||
"nrfjprog",
|
||||
"nrfutil",
|
||||
"cmsis-dap",
|
||||
"sam-ba",
|
||||
"blackmagic"
|
||||
],
|
||||
"use_1200bps_touch": true,
|
||||
"require_upload_port": true,
|
||||
"wait_for_upload_port": true
|
||||
},
|
||||
"url": "https://wiki.seeedstudio.com/XIAO_BLE",
|
||||
"vendor": "Seeed Studio"
|
||||
}
|
||||
@@ -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,63 @@
|
||||
{
|
||||
"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",
|
||||
"openocd_target": "nrf52.cfg"
|
||||
},
|
||||
"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,51 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino":{
|
||||
"ldscript": "esp32s3_out.ld",
|
||||
"partitions": "default.csv",
|
||||
"memory_type": "qio_qspi"
|
||||
},
|
||||
"core": "esp32",
|
||||
"extra_flags": [
|
||||
"-DARDUINO_USB_MODE=1",
|
||||
"-DARDUINO_USB_CDC_ON_BOOT=1",
|
||||
"-DARDUINO_RUNNING_CORE=1",
|
||||
"-DARDUINO_EVENT_RUNNING_CORE=1"
|
||||
],
|
||||
"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": "LilyGo T-Beam supreme (8MB Flash 8MB PSRAM)",
|
||||
"upload": {
|
||||
"flash_size": "8MB",
|
||||
"maximum_ram_size": 327680,
|
||||
"maximum_size": 8388608,
|
||||
"require_upload_port": true,
|
||||
"speed": 460800
|
||||
},
|
||||
"url": "https://www.lilygo.cc/products/t-beamsupreme-m",
|
||||
"vendor": "LilyGo"
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"build": {
|
||||
"arduino": {
|
||||
"ldscript": "nrf52840_s140_v6.ld"
|
||||
},
|
||||
"core": "nRF5",
|
||||
"cpu": "cortex-m4",
|
||||
"extra_flags": "-DARDUINO_NRF52840_TTGO_EINK -DNRF52840_XXAA",
|
||||
"f_cpu": "64000000L",
|
||||
"hwids": [
|
||||
[
|
||||
"0x239A",
|
||||
"0x4405"
|
||||
],
|
||||
[
|
||||
"0x239A",
|
||||
"0x0029"
|
||||
],
|
||||
[
|
||||
"0x239A",
|
||||
"0x002A"
|
||||
]
|
||||
],
|
||||
"usb_product": "elecrow_eink",
|
||||
"mcu": "nrf52840",
|
||||
"variant": "ELECROW-ThinkNode-M1",
|
||||
"bsp": {
|
||||
"name": "adafruit"
|
||||
},
|
||||
"softdevice": {
|
||||
"sd_flags": "-DS140",
|
||||
"sd_name": "s140",
|
||||
"sd_version": "6.1.1",
|
||||
"sd_fwid": "0x00B6"
|
||||
},
|
||||
"bootloader": {
|
||||
"settings_addr": "0xFF000"
|
||||
}
|
||||
},
|
||||
"connectivity": [
|
||||
"bluetooth"
|
||||
],
|
||||
"debug": {
|
||||
"jlink_device": "nRF52840_xxAA",
|
||||
"onboard_tools": [
|
||||
"jlink"
|
||||
],
|
||||
"svd_path": "nrf52840.svd",
|
||||
"openocd_target": "nrf52.cfg"
|
||||
},
|
||||
"frameworks": [
|
||||
"arduino"
|
||||
],
|
||||
"name": "elecrow eink",
|
||||
"upload": {
|
||||
"maximum_ram_size": 248832,
|
||||
"maximum_size": 815104,
|
||||
"speed": 115200,
|
||||
"use_1200bps_touch": true,
|
||||
"require_upload_port": true,
|
||||
"wait_for_upload_port": true,
|
||||
"protocol": "nrfutil",
|
||||
"protocols": [
|
||||
"jlink",
|
||||
"nrfjprog",
|
||||
"nrfutil",
|
||||
"stlink"
|
||||
]
|
||||
},
|
||||
"url": "https://github.com/Elecrow-RD",
|
||||
"vendor": "ELECROW"
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"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",
|
||||
"openocd_target": "nrf52.cfg"
|
||||
},
|
||||
"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 [[ -f .pio/build/$1/firmware.zip && -f .pio/build/$1/firmware.hex ]]; 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></code>, <code>fairness cap</code>, <code>fairness refill</code>, <code>fairness grid</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 <hours></code>, <code>fairness advert 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 <name></code>, <code>filter del <name></code>, <code>filter 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> [secs]</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 <minutes></code> / <code>filter age 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 <mV></code> a <code>set batt.icon.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>set radio.rxps level <level></code> 1–10; 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></code> nebo <code>off</code> (výchozí 3300, pod ním uzel nenaběhne a spí,
|
||||
dokud se článek nezotaví) a <code>set pwr.cutoff <mV></code> nebo <code>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 (INA219, INA226, INA3221; INA260 ho má uvnitř) se
|
||||
nastavuje za běhu a ukládá se: <code>sensor set ina.shunt <mOhm></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;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = [
|
||||
pkgs.platformio
|
||||
# optional: needed as a programmer i.e. for esp32
|
||||
pkgs.avrdude
|
||||
];
|
||||
}
|
||||
+618
@@ -0,0 +1,618 @@
|
||||
**MeshCore-FAQ**<!-- omit from toc -->
|
||||
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<!-- omit from toc -->
|
||||
---
|
||||
|
||||
- [1. Introduction](#1-introduction)
|
||||
- [1.1. Q: What is MeshCore?](#11-q-what-is-meshcore)
|
||||
- [1.2. Q: What do you need to start using MeshCore?](#12-q-what-do-you-need-to-start-using-meshcore)
|
||||
- [1.2.1. Hardware](#121-hardware)
|
||||
- [1.2.2. Firmware](#122-firmware)
|
||||
- [1.2.3. Companion Radio Firmware](#123-companion-radio-firmware)
|
||||
- [1.2.4. Repeater](#124-repeater)
|
||||
- [1.2.5. Room Server](#125-room-server)
|
||||
- [2. Initial Setup](#2-initial-setup)
|
||||
- [2.1. Q: How many devices do I need to start using MeshCore?](#21-q-how-many-devices-do-i-need-to-start-using-meshcore)
|
||||
- [2.2. Q: Does MeshCore cost any money?](#22-q-does-meshcore-cost-any-money)
|
||||
- [2.3. Q: What frequencies are supported by MeshCore?](#23-q-what-frequencies-are-supported-by-meshcore)
|
||||
- [2.4. Q: What is an "advert" in MeshCore?](#24-q-what-is-an-advert-in-meshcore)
|
||||
- [2.5. Q: Is there a hop limit?](#25-q-is-there-a-hop-limit)
|
||||
- [3. Server Administration](#3-server-administration)
|
||||
- [3.1. Q: How do you configure a repeater or a room server?](#31-q-how-do-you-configure-a-repeater-or-a-room-server)
|
||||
- [3.2. Q: Do I need to set the location for a repeater?](#32-q-do-i-need-to-set-the-location-for-a-repeater)
|
||||
- [3.3. Q: What is the password to administer a repeater or a room server?](#33-q-what-is-the-password-to-administer-a-repeater-or-a-room-server)
|
||||
- [3.4. Q: What is the password to join a room server?](#34-q-what-is-the-password-to-join-a-room-server)
|
||||
- [4. T-Deck Related](#4-t-deck-related)
|
||||
- [4.1. Q: What are the steps to get a T-Deck into DFU (Device Firmware Update) mode?](#41-q-what-are-the-steps-to-get-a-t-deck-into-dfu-device-firmware-update-mode)
|
||||
- [4.2. Q: Why is my T-Deck Plus not getting any satellite lock?](#42-q-why-is-my-t-deck-plus-not-getting-any-satellite-lock)
|
||||
- [4.3. Q: Why is my OG (non-Plus) T-Deck not getting any satellite lock?](#43-q-why-is-my-og-non-plus-t-deck-not-getting-any-satellite-lock)
|
||||
- [4.4. Q: What size of SD card does the T-Deck support?](#44-q-what-size-of-sd-card-does-the-t-deck-support)
|
||||
- [4.5. Q: How do I get maps on T-Deck?](#45-q-how-do-i-get-maps-on-t-deck)
|
||||
- [4.6. Q: Where do the map tiles go?](#46-q-where-do-the-map-tiles-go)
|
||||
- [4.7. Q: How to unlock deeper map zoom and server management features on T-Deck?](#47-q-how-to-unlock-deeper-map-zoom-and-server-management-features-on-t-deck)
|
||||
- [4.8. Q: How to decipher the diagnostics screen on T-Deck?](#48-q-how-to-decipher-the-diagnostics-screen-on-t-deck)
|
||||
- [4.9. Q: The T-Deck sound is too loud?](#49-q-the-t-deck-sound-is-too-loud)
|
||||
- [4.10. Q: Can you customize the sound?](#410-q-can-you-customize-the-sound)
|
||||
- [4.11. 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?](#411-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)
|
||||
- [5. General](#5-general)
|
||||
- [5.1. Q: What are BW, SF, and CR?](#51-q-what-are-bw-sf-and-cr)
|
||||
- [5.2. Q: Do MeshCore clients repeat?](#52-q-do-meshcore-clients-repeat)
|
||||
- [5.3. Q: What happens when a node learns a route via a mobile repeater, and that repeater is gone?](#53-q-what-happens-when-a-node-learns-a-route-via-a-mobile-repeater-and-that-repeater-is-gone)
|
||||
- [5.4. Q: How does a node discovery a path to its destination and then use it to send messages in the future, instead of flooding every message it sends like Meshtastic?](#54-q-how-does-a-node-discovery-a-path-to-its-destination-and-then-use-it-to-send-messages-in-the-future-instead-of-flooding-every-message-it-sends-like-meshtastic)
|
||||
- [5.5. Q: Do public channels always flood? Do private channels always flood?](#55-q-do-public-channels-always-flood-do-private-channels-always-flood)
|
||||
- [5.6. Q: what is the public key for the default public channel?](#56-q-what-is-the-public-key-for-the-default-public-channel)
|
||||
- [5.7. Q: Is MeshCore open source?](#57-q-is-meshcore-open-source)
|
||||
- [5.8. Q: How can I support MeshCore?](#58-q-how-can-i-support-meshcore)
|
||||
- [5.9. Q: How do I build MeshCore firmware from source?](#59-q-how-do-i-build-meshcore-firmware-from-source)
|
||||
- [5.10. Q: Are there other MeshCore related open source projects?](#510-q-are-there-other-meshcore-related-open-source-projects)
|
||||
- [5.11. Q: Does MeshCore support ATAK](#511-q-does-meshcore-support-atak)
|
||||
- [5.12. Q: How do I add a node to the MeshCore Map](#512-q-how-do-i-add-a-node-to-the-meshcore-map)
|
||||
- [5.13. Q: Can I use a Raspberry Pi to update a MeshCore radio?](#513-q-can-i-use-a-raspberry-pi-to-update-a-meshcore-radio)
|
||||
- [5.14. Q: Are there are projects built around MeshCore?](#514-q-are-there-are-projects-built-around-meshcore)
|
||||
- [5.14.1. meshcoremqtt](#5141-meshcoremqtt)
|
||||
- [5.14.2. MeshCore for Home Assistant](#5142-meshcore-for-home-assistant)
|
||||
- [5.14.3. Python MeshCore](#5143-python-meshcore)
|
||||
- [5.14.4. meshcore-cli](#5144-meshcore-cli)
|
||||
- [5.14.5. meshcore.js](#5145-meshcorejs)
|
||||
- [6. Troubleshooting](#6-troubleshooting)
|
||||
- [6.1. Q: My client says another client or a repeater or a room server was last seen many, many days ago.](#61-q-my-client-says-another-client-or-a-repeater-or-a-room-server-was-last-seen-many-many-days-ago)
|
||||
- [6.2. 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.](#62-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)
|
||||
- [6.3. Q: How to connect to a repeater via BLE (Bluetooth)?](#63-q-how-to-connect-to-a-repeater-via-ble-bluetooth)
|
||||
- [6.4. Q: I can't connect via Bluetooth, what is the Bluetooth pairing code?](#64-q-i-cant-connect-via-bluetooth-what-is-the-bluetooth-pairing-code)
|
||||
- [6.5. Q: My Heltec V3 keeps disconnecting from my smartphone. It can't hold a solid Bluetooth connection.](#65-q-my-heltec-v3-keeps-disconnecting-from-my-smartphone--it-cant-hold-a-solid-bluetooth-connection)
|
||||
- [6.6. Q: My RAK/T1000-E/xiao\_nRF52 device seems to be corrupted, how do I wipe it clean to start fresh?](#66-q-my-rakt1000-exiao_nrf52-device-seems-to-be-corrupted-how-do-i-wipe-it-clean-to-start-fresh)
|
||||
- [6.7. Q: WebFlasher fails on Linux with failed to open](#67-q-webflasher-fails-on-Linux-with-failed-to-open)
|
||||
|
||||
- [7. Other Questions:](#7-other-questions)
|
||||
- [7.1 Q: How to update nRF (RAK, T114, Seed XIAO) repeater and room server firmware over the air using the new simpler DFU app?](#71-q-how-to-update-nrf-rak-t114-seed-xiao-repeater-and-room-server-firmware-over-the-air-using-the-new-simpler-dfu-app)
|
||||
- [7.2 Q: How to update ESP32-based devices over the air?](#72-q-how-to-update-esp32-based-devices-over-the-air)
|
||||
- [7.3 Q: Is there a way to lower the chance of a failed OTA device firmware update (DFU)?](#73-q-is-there-a-way-to-lower-the-chance-of-a-failed-ota-device-firmware-update-dfu)
|
||||
|
||||
## 1. Introduction
|
||||
|
||||
### 1.1. 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.
|
||||
|
||||
### 1.2. 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).
|
||||
|
||||
#### 1.2.1. 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.
|
||||
|
||||
#### 1.2.2. Firmware
|
||||
MeshCore has four firmware types that are not available on other LoRa systems. MeshCore has the following:
|
||||
|
||||
#### 1.2.3. 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>
|
||||
|
||||
#### 1.2.4. 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 firmware with remote administration features unlocked, or from a BLE Companion client connected to a smartphone running the MeshCore app.
|
||||
|
||||
#### 1.2.5. 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. With channels, messages are either received when it's sent, or not received and missed if the channel user is out of range. Room servers are different and more 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 firmware with remote administration 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 32 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}`
|
||||
|
||||
---
|
||||
|
||||
## 2. Initial Setup
|
||||
|
||||
### 2.1. 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 communicating with other MeshCore users near you.
|
||||
|
||||
If you have two supported devices, and there are not many MeshCore users near you, flash both to BLE Companion firmware so you can use your devices to communicate with your near-by friends and family.
|
||||
|
||||
If you have two supported devices, and there are other MeshcCore users nearby, 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 to 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 repeater 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 devices with the room server firmware.
|
||||
|
||||
### 2.2. 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.
|
||||
|
||||
|
||||
### 2.3. 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
|
||||
|
||||
In UK and EU, 867.5MHz is not allowed to use 250kHz bandwidth and it only allows 2.5% duty cycle for clients. 869.525Mhz allows an airtime of 10%, 250KHz bandwidth, and a higher EIRP, therefore MeshCore nodes can send more often and with more power. That is why this frequency is chosen for UK and EU. This is also why Meshtastic also uses this frequency.
|
||||
|
||||
[Source]([https://](https://discord.com/channels/826570251612323860/1330643963501351004/1356540643853209641))
|
||||
|
||||
the rest of the radio settings are the same for all frequencies:
|
||||
- Spread Factor (SF): 11
|
||||
- Coding Rate (CR): 5
|
||||
- Bandwidth (BW): 250.00
|
||||
|
||||
(Originally MeshCore started with SF 10. recently (as of late April 2025) the community has advocated SF 11 also a viable option for longer range but a little slower transmission. Currently there are MeshCore meshes with SF 10 and SF 11. Liam Cottle's smartphone app's presets now recommend SF 10 for Australia and SF 11 for all other regions and countries. EU and UK has SF 10 and SF 11 presets. Work with your local meshers on deciding with SF number is best for your use cases. In the future, there may be bridge nodes that can bridge SF 10 and SF 11 (or even different frequencies) traffic.)
|
||||
|
||||
### 2.4. 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 its 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}`
|
||||
|
||||
### 2.5. 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.
|
||||
|
||||
|
||||
---
|
||||
|
||||
|
||||
## 3. Server Administration
|
||||
|
||||
### 3.1. Q: How do you configure a repeater or a room server?
|
||||
|
||||
**A:** - When MeshCore is flashed onto a LoRa device is for the first time, it is necessary to set the server device's frequency to make it utilize the frequency that is legal in your country or region.
|
||||
|
||||
Repeater or room server can be administered with one of the options below:
|
||||
|
||||
- After a repeater or room server firmware is flashed on to a LoRa device, go to <https://config.meshcore.dev> and use the web user interface to connect to the LoRa device via USB serial. From there you can set the name of the server, its frequency and other related settings, location, passwords etc.
|
||||
|
||||

|
||||
|
||||
|
||||
- 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
|
||||
|
||||
- Use a MeshCore smartphone clients to remotely administer servers via LoRa.
|
||||
|
||||
- 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>
|
||||
|
||||
|
||||
|
||||
### 3.2. 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.
|
||||
|
||||
### 3.3. 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}`
|
||||
|
||||
|
||||
### 3.4. 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}`
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 4. T-Deck Related
|
||||
|
||||
### 4.1. 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/>
|
||||
|
||||
### 4.2. 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, some 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 the device to check the GPS orientation.
|
||||
|
||||
GPS on T-Deck is always enabled. You can skip the "GPS clock sync" and the T-Deck will continue to try to get a GPS lock. You can go to the `GPS Info` screen; you should see the `Sentences:` counter increasing if the baud rate is correct.
|
||||
|
||||
[Source]([https://](https://discord.com/channels/826570251612323860/1330643963501351004/1356609240302616689))
|
||||
|
||||
### 4.3. 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.
|
||||
|
||||
### 4.4. 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**.
|
||||
|
||||
### 4.5. 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>
|
||||
|
||||
### 4.6. 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.
|
||||
|
||||
### 4.7. 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>
|
||||
|
||||
### 4.8. Q: How to decipher the diagnostics screen on T-Deck?
|
||||
|
||||
**A: ** Space is tight on T-Deck's screen, so the information is a bit cryptic. The format is :
|
||||
`{hops} l:{packet-length}({payload-len}) t:{packet-type} snr:{n} rssi:{n}`
|
||||
|
||||
See here for packet-type: [https://github.com/ripplebiz/MeshCore/blob/main/src/Packet.h#L19](https://github.com/ripplebiz/MeshCore/blob/main/src/Packet.h#L19 "https://github.com/ripplebiz/MeshCore/blob/main/src/Packet.h#L19")
|
||||
|
||||
|
||||
#define PAYLOAD_TYPE_REQ 0x00 // request (prefixed with dest/src hashes, MAC) (enc data: timestamp, blob)
|
||||
#define PAYLOAD_TYPE_RESPONSE 0x01 // response to REQ or ANON_REQ (prefixed with dest/src hashes, MAC) (enc data: timestamp, blob)
|
||||
#define PAYLOAD_TYPE_TXT_MSG 0x02 // a plain text message (prefixed with dest/src hashes, MAC) (enc data: timestamp, text)
|
||||
#define PAYLOAD_TYPE_ACK 0x03 // a simple ack #define PAYLOAD_TYPE_ADVERT 0x04 // a node advertising its Identity
|
||||
#define PAYLOAD_TYPE_GRP_TXT 0x05 // an (unverified) group text message (prefixed with channel hash, MAC) (enc data: timestamp, "name: msg")
|
||||
#define PAYLOAD_TYPE_GRP_DATA 0x06 // an (unverified) group datagram (prefixed with channel hash, MAC) (enc data: timestamp, blob)
|
||||
#define PAYLOAD_TYPE_ANON_REQ 0x07 // generic request (prefixed with dest_hash, ephemeral pub_key, MAC) (enc data: ...)
|
||||
#define PAYLOAD_TYPE_PATH 0x08 // returned path (prefixed with dest/src hashes, MAC) (enc data: path, extra)
|
||||
|
||||
[Source](https://discord.com/channels/1343693475589263471/1343693475589263474/1350611321040932966)
|
||||
|
||||
### 4.9. Q: The T-Deck sound is too loud?
|
||||
### 4.10. 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`
|
||||
|
||||
### 4.11. 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://...")
|
||||
|
||||
---
|
||||
|
||||
## 5. General
|
||||
|
||||
### 5.1. 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
|
||||
|
||||
### 5.2. Q: Do MeshCore clients repeat?
|
||||
**A:** No, MeshCore clients do not repeat. This is the core of MeshCore's messaging-first design. This is to avoid devices flooding the air ware and create endless collisions, so messages sent aren't received.
|
||||
In MeshCore, only repeaters and room server with `set repeat on` repeat.
|
||||
|
||||
### 5.3. 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.
|
||||
|
||||
### 5.4. Q: How does a node discovery a path to its destination and then use it to send messages in the future, instead of flooding every message it sends like Meshtastic?
|
||||
|
||||
Routes are stored in sender's contact list. When you send a message the first time, the message first gets to your destination by flood routing. When your destination node gets the message, it will send back a delivery report to the sender with all repeaters that the original message went through. This delivery report is flood-routed back to you the sender and is a basis for future direct path. When you send the next message, the path will get embedded into the packet and be evaluated by repeaters. If the hop and address of the repeater matches, it will retransmit the message, otherwise it will not retransmit, hence minimizing utilization.
|
||||
|
||||
[Source](https://discord.com/channels/826570251612323860/1330643963501351004/1351279141630119996)
|
||||
|
||||
### 5.5. Q: Do public channels always flood? Do private channels always flood?
|
||||
|
||||
**A:** Yes, group channels are A to B, so there is no defined path. They have to flood. Repeaters can however deny flood traffic up to some hop limit, with the `set flood.max` CLI command. Administrators of repeaters get to set the rules of their repeaters.
|
||||
|
||||
[Source](https://discord.com/channels/1343693475589263471/1343693475589263474/1350023009527664672)
|
||||
|
||||
|
||||
### 5.6. Q: what is the public key for the default public channel?
|
||||
**A:** The smartphone app key is in hex:
|
||||
` 8b3387e9c5cdea6ac9e5edbaa115cd72`
|
||||
|
||||
T-Deck uses the same key but in base64
|
||||
`izOH6cXN6mrJ5e26oRXNcg==`
|
||||
The third character is the capital letter 'O', not zero `0`
|
||||
[Source](https://discord.com/channels/826570251612323860/1330643963501351004/1354194409213792388)
|
||||
|
||||
### 5.7. 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>
|
||||
|
||||
### 5.8. 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)
|
||||
|
||||
### 5.9. Q: How do I build MeshCore firmware from source?
|
||||
**A:** See instructions here:
|
||||
https://discord.com/channels/826570251612323860/1330643963501351004/1341826372120608769
|
||||
|
||||
Build instructions for MeshCore:
|
||||
|
||||
For Windows, first install WSL and Python+pip via: https://plainenglish.io/blog/setting-up-python-on-windows-subsystem-for-linux-wsl-26510f1b2d80
|
||||
|
||||
(Linux, Windows+WSL) In the terminal/shell:
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install libpython3-dev
|
||||
sudo apt install python3-venv
|
||||
```
|
||||
Mac: python3 should be already installed.
|
||||
|
||||
Then it should be the same for all platforms:
|
||||
```
|
||||
python3 -m venv meshcore
|
||||
cd meshcore && source bin/activate
|
||||
pip install -U platformio
|
||||
git clone https://github.com/ripplebiz/MeshCore.git
|
||||
cd MeshCore
|
||||
```
|
||||
open platformio.ini and in `[arduino_base]` edit the `LORA_FREQ=867.5`
|
||||
save, then run:
|
||||
```
|
||||
pio run -e RAK_4631_Repeater
|
||||
```
|
||||
then you'll find `firmware.zip` in `.pio/build/RAK_4631_Repeater`
|
||||
|
||||
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)*
|
||||
|
||||
### 5.10. 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
|
||||
|
||||
### 5.11. Q: Does MeshCore support ATAK
|
||||
**A:** ATAK is not currently on MeshCore's roadmap.
|
||||
|
||||
Meshcore would not be best suited to ATAK because MeshCore:
|
||||
clients do not repeat and therefore you would need a network of repeaters in place
|
||||
will not have a stable path where all clients are constantly moving between repeaters
|
||||
|
||||
MeshCore clients would need to reset path constantly and flood traffic across the network which could lead to lots of collisions with something as chatty as ATAK.
|
||||
|
||||
This could change in the future if MeshCore develops a client firmware that repeats.
|
||||
[Source](https://discord.com/channels/826570251612323860/1330643963501351004/1354780032140054659)
|
||||
|
||||
### 5.12. 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`
|
||||
|
||||
### 5.13. Q: Can I use a Raspberry Pi to update a MeshCore radio?
|
||||
** A:** Yes.
|
||||
You will need to install picocom on the pi.
|
||||
`sudo apt install picocom`
|
||||
|
||||
Then run the following commands to setup the repeater.
|
||||
```
|
||||
picocom -b 115200 /dev/ttyUSB0 --imap lfcrlf
|
||||
set name your_repeater_name
|
||||
time epoch_time
|
||||
password your_unique_password
|
||||
set advert.interval 240
|
||||
advert
|
||||
```
|
||||
Note: If using a RAK the path will most likely be /dev/ttyACM0
|
||||
|
||||
Epoch time comes from https://www.epochconverter.com/
|
||||
|
||||
You can also flash the repeater using esptool. You will need to install esptool with the following command...
|
||||
|
||||
`pip install esptool --break-system-packages`
|
||||
|
||||
Then to flash the firmware to Heltec, obtain the .bin file from https://flasher.meshcore.co.uk/ (download all firmware link)
|
||||
|
||||
For Heltec:
|
||||
`esptool.py -p /dev/ttyUSB0 --chip esp32-s3 write_flash 0x00000 firmware.bin`
|
||||
|
||||
If flashing a visual studio code build bin file, flash with the following offset:
|
||||
`esptool.py -p /dev/ttyUSB0 --chip esp32-s3 write_flash 0x10000 firmware.bin`
|
||||
|
||||
For Pi
|
||||
Download the zip from the online flasher website and use the following command:
|
||||
|
||||
Note: Requires adafruit-nrfutil command which can be installed as follows.
|
||||
`pip install adafruit-nrfutil --break-system-packages`
|
||||
|
||||
```
|
||||
adafruit-nrfutil --verbose dfu serial --package t1000_e_bootloader-0.9.1-5-g488711a_s140_7.3.0.zip -p /dev/ttyACM0 -b 115200 --singlebank --touch 1200
|
||||
```
|
||||
|
||||
[Source](https://discord.com/channels/826570251612323860/1330643963501351004/1342120825251299388)
|
||||
|
||||
### 5.14. Q: Are there are projects built around MeshCore?
|
||||
|
||||
**A:** Yes. See the following:
|
||||
|
||||
#### 5.14.1. meshcoremqtt
|
||||
A Python script to send meshore debug and packet capture data to MQTT for analysis
|
||||
https://github.com/Andrew-a-g/meshcoretomqtt
|
||||
|
||||
#### 5.14.2. MeshCore for Home Assistant
|
||||
A custom Home Assistant integration for MeshCore mesh radio nodes. It allows you to monitor and control MeshCore nodes via USB, BLE, or TCP connections.
|
||||
https://github.com/awolden/meshcore-ha
|
||||
|
||||
#### 5.14.3. Python MeshCore
|
||||
Bindings to access your MeshCore companion radio nodes in python.
|
||||
https://github.com/fdlamotte/meshcore_py
|
||||
|
||||
#### 5.14.4. meshcore-cli
|
||||
CLI interface to MeshCore companion radio over BLE, TCP, or serial. Uses Pyton MeshCore above.
|
||||
https://github.com/fdlamotte/meshcore-cli
|
||||
|
||||
#### 5.14.5. meshcore.js
|
||||
A JavaScript library for interacting with a MeshCore device running the companion radio firmware
|
||||
https://github.com/liamcottle/meshcore.js
|
||||
|
||||
---
|
||||
|
||||
## 6. Troubleshooting
|
||||
|
||||
### 6.1. Q: My client says another client or a repeater or a room server was last seen many, many days ago.
|
||||
### 6.2. 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.
|
||||
|
||||
### 6.3. 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
|
||||
|
||||
### 6.4. Q: I can't connect via Bluetooth, what is the Bluetooth pairing code?
|
||||
|
||||
**A:** the default Bluetooth pairing code is `123456`
|
||||
|
||||
### 6.5. 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 Wi-Fi and Bluetooth connectivity. 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.
|
||||
|
||||
### 6.6. Q: My RAK/T1000-E/xiao_nRF52 device seems to be corrupted, how do I wipe it clean to start fresh?
|
||||
|
||||
**A:**
|
||||
1. Connect USB-C cable to your device, per your device's instruction, get it to flash mode:
|
||||
- For RAK, double click its reset button
|
||||
- For T1000-e, quickly disconnect and reconnect the magnetic side of the cable from the device TWICE
|
||||
- For Heltec T114, click the reset button once (the bottom button)
|
||||
- For Xiao nRF52, click the reset button once. If that doesn't work, quickly double click the reset button twice. If that doesn't work, disconnection the board from your PC and reconnect again ([seeed studio wiki](https://wiki.seeedstudio.com/XIAO_BLE/#access-the-swd-pins-for-debugging-and-reflashing-bootloader))
|
||||
5. A new folder will appear on your computer's desktop
|
||||
6. Download the `flash_erase*.uf2` file for your device on flasher.meshcore.co.uk
|
||||
- RAK WisBlock and Heltec T114: `Flash_erase-nRF32_softdevice_v6.uf2`
|
||||
- Seeed Studio Xiao nRF52 WIO: `Flash_erase-nRF52_softdevice_v7.uf2`
|
||||
8. drag and drop the uf2 file for your device to the root of the new folder
|
||||
9. Wait for the copy to complete. You might get an error dialog, you can ignore it
|
||||
10. Go to https://flasher.meshcore.co.uk/, click `Console` and select the serial port for your connected device
|
||||
11. In the console, press enter. Your flash should now be erased
|
||||
12. You may now flash the latest MeshCore firmware onto your device
|
||||
|
||||
Separately, starting in firmware version 1.7.0, there is a CLI Rescue mode. If your device has a user button (e.g. some RAK, T114), you can activate the rescue mode by hold down the user button of the device within 8 seconds of boot. Then you can use the 'Console' on flasher.meshcore.co.uk
|
||||
|
||||
|
||||
### 6.7. Q: WebFlasher fails on Linux with failed to open
|
||||
|
||||
**A:** If the usb port doesn't have the right ownership for this task, the process fails with the following error:
|
||||
`NetworkError: Failed to execute 'open' on 'SerialPort': Failed to open serial port.`
|
||||
|
||||
Allow the browser user on it:
|
||||
`# setfacl -m u:YOUR_USER_HERE:rw /dev/ttyUSB0`
|
||||
|
||||
---
|
||||
## 7. Other Questions:
|
||||
|
||||
### 7.1 Q: How to update nRF (RAK, T114, Seed XIAO) repeater and room server firmware over the air using the new simpler DFU app?
|
||||
|
||||
**A:** The steps below work on both Android and iOS as nRF has made both apps' user interface the same on both platforms:
|
||||
|
||||
1. Download nRF's DFU app from iOS App Store or Android's Play Store, you can find the app by searching for `nrf dfu`, the app's full name is `nRF Device Firmware Update`
|
||||
2. On flasher.meshcore.co.uk, download the **ZIP** version of the firmware for your nRF device (e.g. RAK or Heltec T114 or Seeed Studio's Xiao)
|
||||
3. From the MeshCore app, login remotely to the repeater you want to update with admin priviledge
|
||||
4. Go to the Command Line tab, type `start ota` and hit enter.
|
||||
5. you should see `OK` to confirm the repeater device is now in OTA mode
|
||||
6. Run the DFU app,tab `Settings` on the top right corner
|
||||
7. Enable `Packets receipt notifications`, and change `Number of Packets` to 10 for RAK, 8 for T114. 8 also works for RAK.
|
||||
9. Select the firmware zip file you downloaded
|
||||
10. Select the device you want to update. If the device you want to updat is not on the list, try enabling`OTA` on the device again
|
||||
11. If the device is not found, enable `Force Scanning` in the DFU app
|
||||
12. Tab the `Upload` to begin OTA update
|
||||
13. If it fails, try turning off and on Bluetooth on your phone. If that doesn't work, try rebooting your phone.
|
||||
14. Wait for the update to complete. It can take a few minutes.
|
||||
|
||||
|
||||
### 7.2 Q: How to update ESP32-based devices over the air?
|
||||
|
||||
**A:** For ESP32-based devices (e.g. Heltec V3):
|
||||
1. On flasher.meshcore.co.uk, download the **non-merged** version of the firmware for your ESP32 device (e.g. `Heltec_v3_repeater-v1.6.2-4449fd3.bin`, no `"merged"` in the file name)
|
||||
2. From the MeshCore app, login remotely to the repeater you want to update with admin priviledge
|
||||
4. Go to the Command Line tab, type `start ota` and hit enter.
|
||||
5. you should see `OK` to confirm the repeater device is now in OTA mode
|
||||
6. The command `start ota` on an ESP32-based device starts a wifi hotspot named `MeshCore OTA`
|
||||
7. From your phone or computer connect to the 'MeshCore OTA' hotspot
|
||||
8. From a browser, go to http://192.168.4.1/update and upload the non-merged bin from the flasher
|
||||
|
||||
|
||||
### 7.3 Q: Is there a way to lower the chance of a failed OTA device firmware update (DFU)?
|
||||
|
||||
**A:** Yes, developer `che aporeps` has an enhanced OTA DFU bootloader for nRF52 based devices. With this bootloader, if it detects that the application firmware is invalid, it falls back to OTA DFU mode so you can attempt to flash again to recover. This bootloader has other changes to make the OTA DFU process more fault tolerant.
|
||||
|
||||
Refer to https://github.com/oltaco/Adafruit_nRF52_Bootloader_OTAFIX for the latest information.
|
||||
|
||||
Currently, the following boards are supported:
|
||||
- Nologo ProMicro
|
||||
- Seeed Studio XIAO nRF52840 BLE
|
||||
- Seeed Studio XIAO nRF52840 BLE SENSE
|
||||
- RAK 4631
|
||||
|
||||
|
||||
|
||||
|
||||
---
|
||||
@@ -0,0 +1,54 @@
|
||||
# Packet Structure
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|----------|----------------------------------|-----------------------------------------------------------|
|
||||
| header | 1 | Contains routing type, payload type, and payload version. |
|
||||
| path_len | 1 | Length of the path field in bytes. |
|
||||
| path | up to 64 (`MAX_PATH_SIZE`) | Stores the routing path if applicable. |
|
||||
| payload | up to 184 (`MAX_PACKET_PAYLOAD`) | The actual data being transmitted. |
|
||||
|
||||
Note: see the [payloads doc](./payloads.md) for more information about the content of payload.
|
||||
|
||||
## Header Breakdown
|
||||
|
||||
bit 0 means the lowest bit (1s place)
|
||||
|
||||
| Bits | Mask | Field | Description |
|
||||
|-------|--------|-----------------|-----------------------------------------------|
|
||||
| 0-1 | `0x03` | Route Type | Flood, Direct, Reserved - see below. |
|
||||
| 2-5 | `0x3C` | Payload Type | Request, Response, ACK, etc. - see below. |
|
||||
| 6-7 | `0xC0` | Payload Version | Versioning of the payload format - see below. |
|
||||
|
||||
## Route Type Values
|
||||
|
||||
| Value | Name | Description |
|
||||
|--------|-------------------------------|--------------------------------------|
|
||||
| `0x00` | `ROUTE_TYPE_TRANSPORT_FLOOD` | Flood routing mode + transport codes |
|
||||
| `0x01` | `ROUTE_TYPE_FLOOD` | Flood routing mode (builds up path). |
|
||||
| `0x02` | `ROUTE_TYPE_DIRECT` | Direct route (path is supplied). |
|
||||
| `0x03` | `ROUTE_TYPE_TRANSPORT_DIRECT` | direct route + transport codes |
|
||||
|
||||
## Payload Type Values
|
||||
|
||||
| Value | Name | Description |
|
||||
|--------|---------------------------|-----------------------------------------------|
|
||||
| `0x00` | `PAYLOAD_TYPE_REQ` | Request (destination/source hashes + MAC). |
|
||||
| `0x01` | `PAYLOAD_TYPE_RESPONSE` | Response to REQ or ANON_REQ. |
|
||||
| `0x02` | `PAYLOAD_TYPE_TXT_MSG` | Plain text message. |
|
||||
| `0x03` | `PAYLOAD_TYPE_ACK` | Acknowledgment. |
|
||||
| `0x04` | `PAYLOAD_TYPE_ADVERT` | Node advertisement. |
|
||||
| `0x05` | `PAYLOAD_TYPE_GRP_TXT` | Group text message (unverified). |
|
||||
| `0x06` | `PAYLOAD_TYPE_GRP_DATA` | Group datagram (unverified). |
|
||||
| `0x07` | `PAYLOAD_TYPE_ANON_REQ` | Anonymous request. |
|
||||
| `0x08` | `PAYLOAD_TYPE_PATH` | Returned path. |
|
||||
| `0x09` | `PAYLOAD_TYPE_TRACE` | trace a path, collecting SNI for each hop. |
|
||||
| `0x0F` | `PAYLOAD_TYPE_RAW_CUSTOM` | Custom packet (raw bytes, custom encryption). |
|
||||
|
||||
## Payload Version Values
|
||||
|
||||
| Value | Version | Description |
|
||||
|--------|---------|---------------------------------------------------|
|
||||
| `0x00` | 1 | 1-byte src/dest hashes, 2-byte MAC. |
|
||||
| `0x01` | 2 | Future version (e.g., 2-byte hashes, 4-byte MAC). |
|
||||
| `0x02` | 3 | Future version. |
|
||||
| `0x03` | 4 | Future version. |
|
||||
@@ -0,0 +1,187 @@
|
||||
# Meshcore payloads
|
||||
Inside of each [meshcore packet](./packet_structure.md) is a payload, identified by the payload type in the packet header. The types of payloads are:
|
||||
|
||||
* Node advertisement.
|
||||
* Acknowledgment.
|
||||
* Returned path.
|
||||
* Request (destination/source hashes + MAC).
|
||||
* Response to REQ or ANON_REQ.
|
||||
* Plain text message.
|
||||
* Anonymous request.
|
||||
* Group text message (unverified).
|
||||
* Group datagram (unverified).
|
||||
* Custom packet (raw bytes, custom encryption).
|
||||
|
||||
This document defines the structure of each of these payload types
|
||||
|
||||
## Important concepts:
|
||||
|
||||
* Node/channel hash: the first byte of the node or channel's public key
|
||||
|
||||
# Node advertisement
|
||||
This kind of payload notifies receivers that a node exists, and gives information about the node
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|---------------|-----------------|----------------------------------------------------------|
|
||||
| public key | 32 | Ed25519 public key of the node |
|
||||
| timestamp | 4 | unix timestamp of advertisement |
|
||||
| signature | 64 | Ed25519 signature of public key, timestamp, and app data |
|
||||
| appdata | rest of payload | optional, see below |
|
||||
|
||||
Appdata
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|---------------|-----------------|-------------------------------------------------------|
|
||||
| flags | 1 | specifies which of the fields are present, see below |
|
||||
| latitude | 4 | decimal latitude multiplied by 1000000, integer |
|
||||
| longitude | 4 | decimal longitude multiplied by 1000000, integer |
|
||||
| feature 1 | 2 | reserved for future use |
|
||||
| feature 2 | 2 | reserved for future use |
|
||||
| name | rest of appdata | name of the node |
|
||||
|
||||
Appdata Flags
|
||||
|
||||
| Value | Name | Description |
|
||||
|--------|----------------|---------------------------------------|
|
||||
| `0x01` | is chat node | advert is for a chat node |
|
||||
| `0x02` | is repeater | advert is for a repeater |
|
||||
| `0x03` | is room server | advert is for a room server |
|
||||
| `0x10` | has location | appdata contains lat/long information |
|
||||
| `0x20` | has feature 1 | Reserved for future use. |
|
||||
| `0x40` | has feature 2 | Reserved for future use. |
|
||||
| `0x80` | has name | appdata contains a node name |
|
||||
|
||||
# Acknowledgement
|
||||
|
||||
An acknowledgement that a message was received. Note that for returned path messages, an acknowledgement will be sent in the "extra" payload (see [Returned Path](#returned-path)) and not as a discrete ackowledgement. CLI commands do not require an acknowledgement, neither discrete nor extra.
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|----------|--------------|------------------------------------------------------------|
|
||||
| checksum | 4 | CRC checksum of message timestamp, text, and sender pubkey |
|
||||
|
||||
|
||||
# Returned path, request, response, and plain text message
|
||||
|
||||
Returned path, request, response, and plain text messages are all formatted in the same way. See the subsection for more details about the ciphertext's associated plaintext representation.
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|------------------|-----------------|------------------------------------------------------|
|
||||
| destination hash | 1 | first byte of destination node public key |
|
||||
| source hash | 1 | first byte of source node public key |
|
||||
| cipher MAC | 2 | MAC for encrypted data in next field |
|
||||
| ciphertext | rest of payload | encrypted message, see subsections below for details |
|
||||
|
||||
## Returned path
|
||||
|
||||
Returned path messages provide a description of the route a packet took from the original author. Receivers will send returned path messages to the author of the original message.
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|-------------|--------------|----------------------------------------------------------------------------------------------|
|
||||
| path length | 1 | length of next field |
|
||||
| path | see above | a list of node hashes (one byte each) |
|
||||
| extra type | 1 | extra, bundled payload type, eg., acknowledgement or response. Same values as in [packet structure](./packet_structure.md) |
|
||||
| extra | rest of data | extra, bundled payload content, follows same format as main content defined by this document |
|
||||
|
||||
## Request
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|--------------|-----------------|----------------------------|
|
||||
| timestamp | 4 | send time (unix timestamp) |
|
||||
| request type | 1 | see below |
|
||||
| request data | rest of payload | depends on request type |
|
||||
|
||||
Request type
|
||||
|
||||
| Value | Name | Description |
|
||||
|--------|--------------------|---------------------------------------|
|
||||
| `0x01` | get status | get status of repeater or room server |
|
||||
| `0x02` | keepalive | TODO |
|
||||
| `0x03` | get telemetry data | TODO |
|
||||
|
||||
### Get status
|
||||
|
||||
Gets information about the node, possibly including the following:
|
||||
|
||||
* Battery level (millivolts)
|
||||
* Current transmit queue length
|
||||
* Current free queue length
|
||||
* Last RSSI value
|
||||
* Number of received packets
|
||||
* Number of sent packets
|
||||
* Total airtime (seconds)
|
||||
* Total uptime (seconds)
|
||||
* Number of packets sent as flood
|
||||
* Number of packets sent directly
|
||||
* Number of packets received as flood
|
||||
* Number of packets received directly
|
||||
* Error flags
|
||||
* Last SNR value
|
||||
* Number of direct route duplicates
|
||||
* Number of flood route duplicates
|
||||
* Number posted (?)
|
||||
* Number of post pushes (?)
|
||||
|
||||
### Keepalive
|
||||
|
||||
No-op request.
|
||||
|
||||
### Get telemetry data
|
||||
|
||||
Request data about sensors on the node, including battery level.
|
||||
|
||||
## Response
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|---------|-----------------|-------------|
|
||||
| tag | 4 | TODO |
|
||||
| content | rest of payload | TODO |
|
||||
|
||||
## Plain text message
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|--------------|-----------------|--------------------------------------------------------------|
|
||||
| timestamp | 4 | send time (unix timestamp) |
|
||||
| flags + TODO | 1 | first six bits are flags (see below), last two bits are TODO |
|
||||
| message | rest of payload | the message content, see next table |
|
||||
|
||||
Flags
|
||||
|
||||
| Value | Description | Message content |
|
||||
|--------|---------------------------|------------------------------------------------------------|
|
||||
| `0x00` | plain text message | the plain text of the message |
|
||||
| `0x01` | CLI command | the command text of the message |
|
||||
| `0x02` | signed plain text message | two bytes of sender prefix, followed by plain text message |
|
||||
|
||||
# Anonymous request
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|------------------|-----------------|-------------------------------------------|
|
||||
| destination hash | 1 | first byte of destination node public key |
|
||||
| public key | 32 | sender's Ed25519 public key |
|
||||
| cipher MAC | 2 | MAC for encrypted data in next field |
|
||||
| ciphertext | rest of payload | encrypted message, see below for details |
|
||||
|
||||
Plaintext message
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|----------------|-----------------|-------------------------------------------------------------------------------|
|
||||
| timestamp | 4 | send time (unix timestamp) |
|
||||
| sync timestamp | 4 | for room server, otherwise absent: sender's "sync messages SINCE x" timestamp |
|
||||
| password | rest of message | password for repeater/room |
|
||||
|
||||
# Group text message / datagram
|
||||
|
||||
| Field | Size (bytes) | Description |
|
||||
|--------------|-----------------|--------------------------------------------|
|
||||
| channel hash | 1 | the first byte of the channel's public key |
|
||||
| cipher MAC | 2 | MAC for encrypted data in next field |
|
||||
| ciphertext | rest of payload | encrypted message, see below for details |
|
||||
|
||||
The plaintext contained in the ciphertext matches the format described in [plain text message](#plain-text-message). Specifically, it consists of a four byte timestamp, a flags byte, and the message. The flags byte will generally be `0x00` because it is a "plain text message". The message will be of the form `<sender name>: <message body>` (eg., `user123: I'm on my way`).
|
||||
|
||||
|
||||
TODO: describe what datagram looks like
|
||||
|
||||
# Custom packet
|
||||
|
||||
Custom packets have no defined format.
|
||||
@@ -0,0 +1,131 @@
|
||||
#include "Button.h"
|
||||
|
||||
Button::Button(uint8_t pin, bool activeState)
|
||||
: _pin(pin), _activeState(activeState), _isAnalog(false), _analogThreshold(20) {
|
||||
_currentState = false; // Initialize as not pressed
|
||||
_lastState = _currentState;
|
||||
}
|
||||
|
||||
Button::Button(uint8_t pin, bool activeState, bool isAnalog, uint16_t analogThreshold)
|
||||
: _pin(pin), _activeState(activeState), _isAnalog(isAnalog), _analogThreshold(analogThreshold) {
|
||||
_currentState = false; // Initialize as not pressed
|
||||
_lastState = _currentState;
|
||||
}
|
||||
|
||||
void Button::begin() {
|
||||
_currentState = readButton();
|
||||
_lastState = _currentState;
|
||||
}
|
||||
|
||||
void Button::update() {
|
||||
uint32_t now = millis();
|
||||
|
||||
// Read button at specified interval
|
||||
if (now - _lastReadTime < BUTTON_READ_INTERVAL_MS) {
|
||||
return;
|
||||
}
|
||||
_lastReadTime = now;
|
||||
|
||||
bool newState = readButton();
|
||||
|
||||
// Check if state has changed
|
||||
if (newState != _lastState) {
|
||||
_stateChangeTime = now;
|
||||
}
|
||||
|
||||
// Debounce check
|
||||
if ((now - _stateChangeTime) > BUTTON_DEBOUNCE_TIME_MS) {
|
||||
if (newState != _currentState) {
|
||||
_currentState = newState;
|
||||
handleStateChange();
|
||||
}
|
||||
}
|
||||
|
||||
_lastState = newState;
|
||||
|
||||
// Handle multi-click timeout
|
||||
if (_state == WAITING_FOR_MULTI_CLICK && (now - _releaseTime) > BUTTON_CLICK_TIMEOUT_MS) {
|
||||
// Timeout reached, process the clicks
|
||||
if (_clickCount == 1) {
|
||||
triggerEvent(SHORT_PRESS);
|
||||
} else if (_clickCount == 2) {
|
||||
triggerEvent(DOUBLE_PRESS);
|
||||
} else if (_clickCount == 3) {
|
||||
triggerEvent(TRIPLE_PRESS);
|
||||
} else if (_clickCount >= 4) {
|
||||
triggerEvent(QUADRUPLE_PRESS);
|
||||
}
|
||||
|
||||
_clickCount = 0;
|
||||
_state = IDLE;
|
||||
}
|
||||
|
||||
// Handle long press while button is held
|
||||
if (_state == PRESSED && (now - _pressTime) > BUTTON_LONG_PRESS_TIME_MS) {
|
||||
triggerEvent(LONG_PRESS);
|
||||
_state = IDLE; // Prevent multiple press events
|
||||
_clickCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool Button::readButton() {
|
||||
if (_isAnalog) {
|
||||
return (analogRead(_pin) < _analogThreshold);
|
||||
} else {
|
||||
return (digitalRead(_pin) == _activeState);
|
||||
}
|
||||
}
|
||||
|
||||
void Button::handleStateChange() {
|
||||
uint32_t now = millis();
|
||||
|
||||
if (_currentState) {
|
||||
// Button pressed
|
||||
_pressTime = now;
|
||||
_state = PRESSED;
|
||||
triggerEvent(ANY_PRESS);
|
||||
} else {
|
||||
// Button released
|
||||
if (_state == PRESSED) {
|
||||
uint32_t pressDuration = now - _pressTime;
|
||||
|
||||
if (pressDuration < BUTTON_LONG_PRESS_TIME_MS) {
|
||||
// Short press detected
|
||||
_clickCount++;
|
||||
_releaseTime = now;
|
||||
_state = WAITING_FOR_MULTI_CLICK;
|
||||
} else {
|
||||
// Long press already handled in update()
|
||||
_state = IDLE;
|
||||
_clickCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Button::triggerEvent(EventType event) {
|
||||
_lastEvent = event;
|
||||
|
||||
switch (event) {
|
||||
case ANY_PRESS:
|
||||
if (_onAnyPress) _onAnyPress();
|
||||
break;
|
||||
case SHORT_PRESS:
|
||||
if (_onShortPress) _onShortPress();
|
||||
break;
|
||||
case DOUBLE_PRESS:
|
||||
if (_onDoublePress) _onDoublePress();
|
||||
break;
|
||||
case TRIPLE_PRESS:
|
||||
if (_onTriplePress) _onTriplePress();
|
||||
break;
|
||||
case QUADRUPLE_PRESS:
|
||||
if (_onQuadruplePress) _onQuadruplePress();
|
||||
break;
|
||||
case LONG_PRESS:
|
||||
if (_onLongPress) _onLongPress();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <functional>
|
||||
|
||||
// Button timing configuration
|
||||
#define BUTTON_DEBOUNCE_TIME_MS 50 // Debounce time in ms
|
||||
#define BUTTON_CLICK_TIMEOUT_MS 500 // Max time between clicks for multi-click
|
||||
#define BUTTON_LONG_PRESS_TIME_MS 3000 // Time to trigger long press (3 seconds)
|
||||
#define BUTTON_READ_INTERVAL_MS 10 // How often to read the button
|
||||
|
||||
class Button {
|
||||
public:
|
||||
enum EventType {
|
||||
NONE,
|
||||
SHORT_PRESS,
|
||||
DOUBLE_PRESS,
|
||||
TRIPLE_PRESS,
|
||||
QUADRUPLE_PRESS,
|
||||
LONG_PRESS,
|
||||
ANY_PRESS
|
||||
};
|
||||
|
||||
using EventCallback = std::function<void()>;
|
||||
|
||||
Button(uint8_t pin, bool activeState = LOW);
|
||||
Button(uint8_t pin, bool activeState, bool isAnalog, uint16_t analogThreshold = 20);
|
||||
|
||||
void begin();
|
||||
void update();
|
||||
|
||||
// Set callbacks for different events
|
||||
void onShortPress(EventCallback callback) { _onShortPress = callback; }
|
||||
void onDoublePress(EventCallback callback) { _onDoublePress = callback; }
|
||||
void onTriplePress(EventCallback callback) { _onTriplePress = callback; }
|
||||
void onQuadruplePress(EventCallback callback) { _onQuadruplePress = callback; }
|
||||
void onLongPress(EventCallback callback) { _onLongPress = callback; }
|
||||
void onAnyPress(EventCallback callback) { _onAnyPress = callback; }
|
||||
|
||||
// State getters
|
||||
bool isPressed() const { return _currentState; }
|
||||
EventType getLastEvent() const { return _lastEvent; }
|
||||
|
||||
private:
|
||||
enum State {
|
||||
IDLE,
|
||||
PRESSED,
|
||||
RELEASED,
|
||||
WAITING_FOR_MULTI_CLICK
|
||||
};
|
||||
|
||||
uint8_t _pin;
|
||||
bool _activeState;
|
||||
bool _isAnalog;
|
||||
uint16_t _analogThreshold;
|
||||
|
||||
State _state = IDLE;
|
||||
bool _currentState;
|
||||
bool _lastState;
|
||||
|
||||
uint32_t _stateChangeTime = 0;
|
||||
uint32_t _pressTime = 0;
|
||||
uint32_t _releaseTime = 0;
|
||||
uint32_t _lastReadTime = 0;
|
||||
|
||||
uint8_t _clickCount = 0;
|
||||
EventType _lastEvent = NONE;
|
||||
|
||||
// Callbacks
|
||||
EventCallback _onShortPress = nullptr;
|
||||
EventCallback _onDoublePress = nullptr;
|
||||
EventCallback _onTriplePress = nullptr;
|
||||
EventCallback _onQuadruplePress = nullptr;
|
||||
EventCallback _onLongPress = nullptr;
|
||||
EventCallback _onAnyPress = nullptr;
|
||||
|
||||
bool readButton();
|
||||
void handleStateChange();
|
||||
void triggerEvent(EventType event);
|
||||
};
|
||||
@@ -0,0 +1,444 @@
|
||||
#include <Arduino.h>
|
||||
#include "DataStore.h"
|
||||
|
||||
DataStore::DataStore(FILESYSTEM& fs, mesh::RTCClock& clock) : _fs(&fs), _clock(&clock),
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
identity_store(fs, "")
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
identity_store(fs, "/identity")
|
||||
#else
|
||||
identity_store(fs, "/identity")
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
static File openWrite(FILESYSTEM* _fs, const char* filename) {
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
_fs->remove(filename);
|
||||
return _fs->open(filename, FILE_O_WRITE);
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
return _fs->open(filename, "w");
|
||||
#else
|
||||
return _fs->open(filename, "w", true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void DataStore::begin() {
|
||||
#if defined(RP2040_PLATFORM)
|
||||
identity_store.begin();
|
||||
#endif
|
||||
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
checkAdvBlobFile();
|
||||
#else
|
||||
// init 'blob store' support
|
||||
_fs->mkdir("/bl");
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(ESP32)
|
||||
#include <SPIFFS.h>
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
#include <LittleFS.h>
|
||||
#elif defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
#include <InternalFileSystem.h>
|
||||
#endif
|
||||
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
int _countLfsBlock(void *p, lfs_block_t block){
|
||||
lfs_size_t *size = (lfs_size_t*) p;
|
||||
*size += 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
lfs_ssize_t _getLfsUsedBlockCount() {
|
||||
lfs_size_t size = 0;
|
||||
lfs_traverse(InternalFS._getFS(), _countLfsBlock, &size);
|
||||
return size;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t DataStore::getStorageUsedKb() const {
|
||||
#if defined(ESP32)
|
||||
return SPIFFS.usedBytes() / 1024;
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
FSInfo info;
|
||||
info.usedBytes = 0;
|
||||
_fs->info(info);
|
||||
return info.usedBytes / 1024;
|
||||
#elif defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
const lfs_config* config = InternalFS._getFS()->cfg;
|
||||
int usedBlockCount = _getLfsUsedBlockCount();
|
||||
int usedBytes = config->block_size * usedBlockCount;
|
||||
return usedBytes / 1024;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
uint32_t DataStore::getStorageTotalKb() const {
|
||||
#if defined(ESP32)
|
||||
return SPIFFS.totalBytes() / 1024;
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
FSInfo info;
|
||||
info.totalBytes = 0;
|
||||
_fs->info(info);
|
||||
return info.totalBytes / 1024;
|
||||
#elif defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
const lfs_config* config = InternalFS._getFS()->cfg;
|
||||
int totalBytes = config->block_size * config->block_count;
|
||||
return totalBytes / 1024;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
File DataStore::openRead(const char* filename) {
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
return _fs->open(filename, FILE_O_READ);
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
return _fs->open(filename, "r");
|
||||
#else
|
||||
return _fs->open(filename, "r", false);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool DataStore::removeFile(const char* filename) {
|
||||
return _fs->remove(filename);
|
||||
}
|
||||
|
||||
bool DataStore::formatFileSystem() {
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
return _fs->format();
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
return LittleFS.format();
|
||||
#elif defined(ESP32)
|
||||
return ((fs::SPIFFSFS *)_fs)->format();
|
||||
#else
|
||||
#error "need to implement format()"
|
||||
#endif
|
||||
}
|
||||
|
||||
bool DataStore::loadMainIdentity(mesh::LocalIdentity &identity) {
|
||||
return identity_store.load("_main", identity);
|
||||
}
|
||||
|
||||
bool DataStore::saveMainIdentity(const mesh::LocalIdentity &identity) {
|
||||
return identity_store.save("_main", identity);
|
||||
}
|
||||
|
||||
void DataStore::loadPrefs(NodePrefs& prefs, double& node_lat, double& node_lon) {
|
||||
if (_fs->exists("/new_prefs")) {
|
||||
loadPrefsInt("/new_prefs", prefs, node_lat, node_lon); // new filename
|
||||
} else if (_fs->exists("/node_prefs")) {
|
||||
loadPrefsInt("/node_prefs", prefs, node_lat, node_lon);
|
||||
savePrefs(prefs, node_lat, node_lon); // save to new filename
|
||||
_fs->remove("/node_prefs"); // remove old
|
||||
}
|
||||
}
|
||||
|
||||
void DataStore::loadPrefsInt(const char *filename, NodePrefs& _prefs, double& node_lat, double& node_lon) {
|
||||
#if defined(RP2040_PLATFORM)
|
||||
File file = _fs->open(filename, "r");
|
||||
#else
|
||||
File file = _fs->open(filename);
|
||||
#endif
|
||||
if (file) {
|
||||
uint8_t pad[8];
|
||||
|
||||
file.read((uint8_t *)&_prefs.airtime_factor, sizeof(float)); // 0
|
||||
file.read((uint8_t *)_prefs.node_name, sizeof(_prefs.node_name)); // 4
|
||||
file.read(pad, 4); // 36
|
||||
file.read((uint8_t *)&node_lat, sizeof(node_lat)); // 40
|
||||
file.read((uint8_t *)&node_lon, sizeof(node_lon)); // 48
|
||||
file.read((uint8_t *)&_prefs.freq, sizeof(_prefs.freq)); // 56
|
||||
file.read((uint8_t *)&_prefs.sf, sizeof(_prefs.sf)); // 60
|
||||
file.read((uint8_t *)&_prefs.cr, sizeof(_prefs.cr)); // 61
|
||||
file.read((uint8_t *)&_prefs.reserved1, sizeof(_prefs.reserved1)); // 62
|
||||
file.read((uint8_t *)&_prefs.manual_add_contacts, sizeof(_prefs.manual_add_contacts)); // 63
|
||||
file.read((uint8_t *)&_prefs.bw, sizeof(_prefs.bw)); // 64
|
||||
file.read((uint8_t *)&_prefs.tx_power_dbm, sizeof(_prefs.tx_power_dbm)); // 68
|
||||
file.read((uint8_t *)&_prefs.telemetry_mode_base, sizeof(_prefs.telemetry_mode_base)); // 69
|
||||
file.read((uint8_t *)&_prefs.telemetry_mode_loc, sizeof(_prefs.telemetry_mode_loc)); // 70
|
||||
file.read((uint8_t *)&_prefs.telemetry_mode_env, sizeof(_prefs.telemetry_mode_env)); // 71
|
||||
file.read((uint8_t *)&_prefs.rx_delay_base, sizeof(_prefs.rx_delay_base)); // 72
|
||||
file.read((uint8_t *)&_prefs.advert_loc_policy, sizeof(_prefs.advert_loc_policy)); // 76
|
||||
file.read(pad, 3); // 77
|
||||
file.read((uint8_t *)&_prefs.ble_pin, sizeof(_prefs.ble_pin)); // 80
|
||||
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void DataStore::savePrefs(const NodePrefs& _prefs, double node_lat, double node_lon) {
|
||||
File file = openWrite(_fs, "/new_prefs");
|
||||
if (file) {
|
||||
uint8_t pad[8];
|
||||
memset(pad, 0, sizeof(pad));
|
||||
|
||||
file.write((uint8_t *)&_prefs.airtime_factor, sizeof(float)); // 0
|
||||
file.write((uint8_t *)_prefs.node_name, sizeof(_prefs.node_name)); // 4
|
||||
file.write(pad, 4); // 36
|
||||
file.write((uint8_t *)&node_lat, sizeof(node_lat)); // 40
|
||||
file.write((uint8_t *)&node_lon, sizeof(node_lon)); // 48
|
||||
file.write((uint8_t *)&_prefs.freq, sizeof(_prefs.freq)); // 56
|
||||
file.write((uint8_t *)&_prefs.sf, sizeof(_prefs.sf)); // 60
|
||||
file.write((uint8_t *)&_prefs.cr, sizeof(_prefs.cr)); // 61
|
||||
file.write((uint8_t *)&_prefs.reserved1, sizeof(_prefs.reserved1)); // 62
|
||||
file.write((uint8_t *)&_prefs.manual_add_contacts, sizeof(_prefs.manual_add_contacts)); // 63
|
||||
file.write((uint8_t *)&_prefs.bw, sizeof(_prefs.bw)); // 64
|
||||
file.write((uint8_t *)&_prefs.tx_power_dbm, sizeof(_prefs.tx_power_dbm)); // 68
|
||||
file.write((uint8_t *)&_prefs.telemetry_mode_base, sizeof(_prefs.telemetry_mode_base)); // 69
|
||||
file.write((uint8_t *)&_prefs.telemetry_mode_loc, sizeof(_prefs.telemetry_mode_loc)); // 70
|
||||
file.write((uint8_t *)&_prefs.telemetry_mode_env, sizeof(_prefs.telemetry_mode_env)); // 71
|
||||
file.write((uint8_t *)&_prefs.rx_delay_base, sizeof(_prefs.rx_delay_base)); // 72
|
||||
file.write((uint8_t *)&_prefs.advert_loc_policy, sizeof(_prefs.advert_loc_policy)); // 76
|
||||
file.write(pad, 3); // 77
|
||||
file.write((uint8_t *)&_prefs.ble_pin, sizeof(_prefs.ble_pin)); // 80
|
||||
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void DataStore::loadContacts(DataStoreHost* host) {
|
||||
if (_fs->exists("/contacts3")) {
|
||||
#if defined(RP2040_PLATFORM)
|
||||
File file = _fs->open("/contacts3", "r");
|
||||
#else
|
||||
File file = _fs->open("/contacts3");
|
||||
#endif
|
||||
if (file) {
|
||||
bool full = false;
|
||||
while (!full) {
|
||||
ContactInfo c;
|
||||
uint8_t pub_key[32];
|
||||
uint8_t unused;
|
||||
|
||||
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 *)&c.sync_since, 4) == 4); // was 'reserved'
|
||||
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);
|
||||
success = success && (file.read((uint8_t *)&c.lastmod, 4) == 4);
|
||||
success = success && (file.read((uint8_t *)&c.gps_lat, 4) == 4);
|
||||
success = success && (file.read((uint8_t *)&c.gps_lon, 4) == 4);
|
||||
|
||||
if (!success) break; // EOF
|
||||
|
||||
c.id = mesh::Identity(pub_key);
|
||||
if (!host->onContactLoaded(c)) full = true;
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DataStore::saveContacts(DataStoreHost* host) {
|
||||
File file = openWrite(_fs, "/contacts3");
|
||||
if (file) {
|
||||
uint32_t idx = 0;
|
||||
ContactInfo c;
|
||||
uint8_t unused = 0;
|
||||
|
||||
while (host->getContactForSave(idx, 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 *)&c.sync_since, 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);
|
||||
success = success && (file.write((uint8_t *)&c.lastmod, 4) == 4);
|
||||
success = success && (file.write((uint8_t *)&c.gps_lat, 4) == 4);
|
||||
success = success && (file.write((uint8_t *)&c.gps_lon, 4) == 4);
|
||||
|
||||
if (!success) break; // write failed
|
||||
|
||||
idx++; // advance to next contact
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
void DataStore::loadChannels(DataStoreHost* host) {
|
||||
if (_fs->exists("/channels2")) {
|
||||
#if defined(RP2040_PLATFORM)
|
||||
File file = _fs->open("/channels2", "r");
|
||||
#else
|
||||
File file = _fs->open("/channels2");
|
||||
#endif
|
||||
if (file) {
|
||||
bool full = false;
|
||||
uint8_t channel_idx = 0;
|
||||
while (!full) {
|
||||
ChannelDetails ch;
|
||||
uint8_t unused[4];
|
||||
|
||||
bool success = (file.read(unused, 4) == 4);
|
||||
success = success && (file.read((uint8_t *)ch.name, 32) == 32);
|
||||
success = success && (file.read((uint8_t *)ch.channel.secret, 32) == 32);
|
||||
|
||||
if (!success) break; // EOF
|
||||
|
||||
if (host->onChannelLoaded(channel_idx, ch)) {
|
||||
channel_idx++;
|
||||
} else {
|
||||
full = true;
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DataStore::saveChannels(DataStoreHost* host) {
|
||||
File file = openWrite(_fs, "/channels2");
|
||||
if (file) {
|
||||
uint8_t channel_idx = 0;
|
||||
ChannelDetails ch;
|
||||
uint8_t unused[4];
|
||||
memset(unused, 0, 4);
|
||||
|
||||
while (host->getChannelForSave(channel_idx, ch)) {
|
||||
bool success = (file.write(unused, 4) == 4);
|
||||
success = success && (file.write((uint8_t *)ch.name, 32) == 32);
|
||||
success = success && (file.write((uint8_t *)ch.channel.secret, 32) == 32);
|
||||
|
||||
if (!success) break; // write failed
|
||||
channel_idx++;
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
|
||||
#define MAX_ADVERT_PKT_LEN (2 + 32 + PUB_KEY_SIZE + 4 + SIGNATURE_SIZE + MAX_ADVERT_DATA_SIZE)
|
||||
|
||||
struct BlobRec {
|
||||
uint32_t timestamp;
|
||||
uint8_t key[7];
|
||||
uint8_t len;
|
||||
uint8_t data[MAX_ADVERT_PKT_LEN];
|
||||
};
|
||||
|
||||
void DataStore::checkAdvBlobFile() {
|
||||
if (!_fs->exists("/adv_blobs")) {
|
||||
File file = openWrite(_fs, "/adv_blobs");
|
||||
if (file) {
|
||||
BlobRec zeroes;
|
||||
memset(&zeroes, 0, sizeof(zeroes));
|
||||
for (int i = 0; i < 20; i++) { // pre-allocate to fixed size
|
||||
file.write((uint8_t *) &zeroes, sizeof(zeroes));
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t DataStore::getBlobByKey(const uint8_t key[], int key_len, uint8_t dest_buf[]) {
|
||||
File file = _fs->open("/adv_blobs");
|
||||
uint8_t len = 0; // 0 = not found
|
||||
|
||||
if (file) {
|
||||
BlobRec tmp;
|
||||
while (file.read((uint8_t *) &tmp, sizeof(tmp)) == sizeof(tmp)) {
|
||||
if (memcmp(key, tmp.key, sizeof(tmp.key)) == 0) { // only match by 7 byte prefix
|
||||
len = tmp.len;
|
||||
memcpy(dest_buf, tmp.data, len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
bool DataStore::putBlobByKey(const uint8_t key[], int key_len, const uint8_t src_buf[], uint8_t len) {
|
||||
if (len < PUB_KEY_SIZE+4+SIGNATURE_SIZE || len > MAX_ADVERT_PKT_LEN) return false;
|
||||
|
||||
checkAdvBlobFile();
|
||||
|
||||
File file = _fs->open("/adv_blobs", FILE_O_WRITE);
|
||||
if (file) {
|
||||
uint32_t pos = 0, found_pos = 0;
|
||||
uint32_t min_timestamp = 0xFFFFFFFF;
|
||||
|
||||
// search for matching key OR evict by oldest timestmap
|
||||
BlobRec tmp;
|
||||
file.seek(0);
|
||||
while (file.read((uint8_t *) &tmp, sizeof(tmp)) == sizeof(tmp)) {
|
||||
if (memcmp(key, tmp.key, sizeof(tmp.key)) == 0) { // only match by 7 byte prefix
|
||||
found_pos = pos;
|
||||
break;
|
||||
}
|
||||
if (tmp.timestamp < min_timestamp) {
|
||||
min_timestamp = tmp.timestamp;
|
||||
found_pos = pos;
|
||||
}
|
||||
|
||||
pos += sizeof(tmp);
|
||||
}
|
||||
|
||||
memcpy(tmp.key, key, sizeof(tmp.key)); // just record 7 byte prefix of key
|
||||
memcpy(tmp.data, src_buf, len);
|
||||
tmp.len = len;
|
||||
tmp.timestamp = _clock->getCurrentTime();
|
||||
|
||||
file.seek(found_pos);
|
||||
file.write((uint8_t *) &tmp, sizeof(tmp));
|
||||
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
return false; // error
|
||||
}
|
||||
#else
|
||||
uint8_t DataStore::getBlobByKey(const uint8_t key[], int key_len, uint8_t dest_buf[]) {
|
||||
char path[64];
|
||||
char fname[18];
|
||||
|
||||
if (key_len > 8) key_len = 8; // just use first 8 bytes (prefix)
|
||||
mesh::Utils::toHex(fname, key, key_len);
|
||||
sprintf(path, "/bl/%s", fname);
|
||||
|
||||
if (_fs->exists(path)) {
|
||||
#if defined(RP2040_PLATFORM)
|
||||
File f = _fs->open(path, "r");
|
||||
#else
|
||||
File f = _fs->open(path);
|
||||
#endif
|
||||
if (f) {
|
||||
int len = f.read(dest_buf, 255); // currently MAX 255 byte blob len supported!!
|
||||
f.close();
|
||||
return len;
|
||||
}
|
||||
}
|
||||
return 0; // not found
|
||||
}
|
||||
|
||||
bool DataStore::putBlobByKey(const uint8_t key[], int key_len, const uint8_t src_buf[], uint8_t len) {
|
||||
char path[64];
|
||||
char fname[18];
|
||||
|
||||
if (key_len > 8) key_len = 8; // just use first 8 bytes (prefix)
|
||||
mesh::Utils::toHex(fname, key, key_len);
|
||||
sprintf(path, "/bl/%s", fname);
|
||||
|
||||
File f = openWrite(_fs, path);
|
||||
if (f) {
|
||||
int n = f.write(src_buf, len);
|
||||
f.close();
|
||||
if (n == len) return true; // success!
|
||||
|
||||
_fs->remove(path); // blob was only partially written!
|
||||
}
|
||||
return false; // error
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include <helpers/IdentityStore.h>
|
||||
#include <helpers/ContactInfo.h>
|
||||
#include <helpers/ChannelDetails.h>
|
||||
#include "NodePrefs.h"
|
||||
|
||||
class DataStoreHost {
|
||||
public:
|
||||
virtual bool onContactLoaded(const ContactInfo& contact) =0;
|
||||
virtual bool getContactForSave(uint32_t idx, ContactInfo& contact) =0;
|
||||
virtual bool onChannelLoaded(uint8_t channel_idx, const ChannelDetails& ch) =0;
|
||||
virtual bool getChannelForSave(uint8_t channel_idx, ChannelDetails& ch) =0;
|
||||
};
|
||||
|
||||
class DataStore {
|
||||
FILESYSTEM* _fs;
|
||||
mesh::RTCClock* _clock;
|
||||
IdentityStore identity_store;
|
||||
|
||||
void loadPrefsInt(const char *filename, NodePrefs& prefs, double& node_lat, double& node_lon);
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
void checkAdvBlobFile();
|
||||
#endif
|
||||
|
||||
public:
|
||||
DataStore(FILESYSTEM& fs, mesh::RTCClock& clock);
|
||||
void begin();
|
||||
bool formatFileSystem();
|
||||
bool loadMainIdentity(mesh::LocalIdentity &identity);
|
||||
bool saveMainIdentity(const mesh::LocalIdentity &identity);
|
||||
void loadPrefs(NodePrefs& prefs, double& node_lat, double& node_lon);
|
||||
void savePrefs(const NodePrefs& prefs, double node_lat, double node_lon);
|
||||
void loadContacts(DataStoreHost* host);
|
||||
void saveContacts(DataStoreHost* host);
|
||||
void loadChannels(DataStoreHost* host);
|
||||
void saveChannels(DataStoreHost* host);
|
||||
uint8_t getBlobByKey(const uint8_t key[], int key_len, uint8_t dest_buf[]);
|
||||
bool putBlobByKey(const uint8_t key[], int key_len, const uint8_t src_buf[], uint8_t len);
|
||||
File openRead(const char* filename);
|
||||
bool removeFile(const char* filename);
|
||||
uint32_t getStorageUsedKb() const;
|
||||
uint32_t getStorageTotalKb() const;
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,210 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Mesh.h>
|
||||
#ifdef DISPLAY_CLASS
|
||||
#include "UITask.h"
|
||||
#endif
|
||||
|
||||
/*------------ Frame Protocol --------------*/
|
||||
#define FIRMWARE_VER_CODE 6
|
||||
|
||||
#ifndef FIRMWARE_BUILD_DATE
|
||||
#define FIRMWARE_BUILD_DATE "29 Jun 2025"
|
||||
#endif
|
||||
|
||||
#ifndef FIRMWARE_VERSION
|
||||
#define FIRMWARE_VERSION "v1.7.1"
|
||||
#endif
|
||||
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
#include <InternalFileSystem.h>
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
#include <LittleFS.h>
|
||||
#elif defined(ESP32)
|
||||
#include <SPIFFS.h>
|
||||
#endif
|
||||
|
||||
#include "DataStore.h"
|
||||
#include "NodePrefs.h"
|
||||
|
||||
#include <RTClib.h>
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
#include <helpers/BaseSerialInterface.h>
|
||||
#include <helpers/IdentityStore.h>
|
||||
#include <helpers/SimpleMeshTables.h>
|
||||
#include <helpers/StaticPoolPacketManager.h>
|
||||
#include <target.h>
|
||||
|
||||
/* ---------------------------------- CONFIGURATION ------------------------------------- */
|
||||
|
||||
#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_LORA_TX_POWER
|
||||
#define MAX_LORA_TX_POWER LORA_TX_POWER
|
||||
#endif
|
||||
|
||||
#ifndef MAX_CONTACTS
|
||||
#define MAX_CONTACTS 100
|
||||
#endif
|
||||
|
||||
#ifndef OFFLINE_QUEUE_SIZE
|
||||
#define OFFLINE_QUEUE_SIZE 16
|
||||
#endif
|
||||
|
||||
#ifndef BLE_NAME_PREFIX
|
||||
#define BLE_NAME_PREFIX "MeshCore-"
|
||||
#endif
|
||||
|
||||
#include <helpers/BaseChatMesh.h>
|
||||
|
||||
/* -------------------------------------------------------------------------------------- */
|
||||
|
||||
#define REQ_TYPE_GET_STATUS 0x01 // same as _GET_STATS
|
||||
#define REQ_TYPE_KEEP_ALIVE 0x02
|
||||
#define REQ_TYPE_GET_TELEMETRY_DATA 0x03
|
||||
|
||||
class MyMesh : public BaseChatMesh, public DataStoreHost {
|
||||
public:
|
||||
MyMesh(mesh::Radio &radio, mesh::RNG &rng, mesh::RTCClock &rtc, SimpleMeshTables &tables, DataStore& store);
|
||||
|
||||
void begin(bool has_display);
|
||||
void startInterface(BaseSerialInterface &serial);
|
||||
|
||||
const char *getNodeName();
|
||||
NodePrefs *getNodePrefs();
|
||||
uint32_t getBLEPin();
|
||||
|
||||
void loop();
|
||||
void handleCmdFrame(size_t len);
|
||||
bool advert();
|
||||
void enterCLIRescue();
|
||||
|
||||
protected:
|
||||
float getAirtimeBudgetFactor() const override;
|
||||
int getInterferenceThreshold() const override;
|
||||
int calcRxDelay(float score, uint32_t air_time) const override;
|
||||
|
||||
void logRxRaw(float snr, float rssi, const uint8_t raw[], int len) override;
|
||||
bool isAutoAddEnabled() const override;
|
||||
void onDiscoveredContact(ContactInfo &contact, bool is_new, uint8_t path_len, const uint8_t* path) override;
|
||||
void onContactPathUpdated(const ContactInfo &contact) override;
|
||||
bool processAck(const uint8_t *data) override;
|
||||
void queueMessage(const ContactInfo &from, uint8_t txt_type, mesh::Packet *pkt, uint32_t sender_timestamp,
|
||||
const uint8_t *extra, int extra_len, const char *text);
|
||||
|
||||
void onMessageRecv(const ContactInfo &from, mesh::Packet *pkt, uint32_t sender_timestamp,
|
||||
const char *text) override;
|
||||
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;
|
||||
|
||||
uint8_t onContactRequest(const ContactInfo &contact, uint32_t sender_timestamp, const uint8_t *data,
|
||||
uint8_t len, uint8_t *reply) override;
|
||||
void onContactResponse(const ContactInfo &contact, const uint8_t *data, uint8_t len) override;
|
||||
void onRawDataRecv(mesh::Packet *packet) override;
|
||||
void onTraceRecv(mesh::Packet *packet, uint32_t tag, uint32_t auth_code, uint8_t flags,
|
||||
const uint8_t *path_snrs, const uint8_t *path_hashes, uint8_t path_len) override;
|
||||
|
||||
uint32_t calcFloodTimeoutMillisFor(uint32_t pkt_airtime_millis) const override;
|
||||
uint32_t calcDirectTimeoutMillisFor(uint32_t pkt_airtime_millis, uint8_t path_len) const override;
|
||||
void onSendTimeout() override;
|
||||
|
||||
// DataStoreHost methods
|
||||
bool onContactLoaded(const ContactInfo& contact) override { return addContact(contact); }
|
||||
bool getContactForSave(uint32_t idx, ContactInfo& contact) override { return getContactByIdx(idx, contact); }
|
||||
bool onChannelLoaded(uint8_t channel_idx, const ChannelDetails& ch) override { return setChannel(channel_idx, ch); }
|
||||
bool getChannelForSave(uint8_t channel_idx, ChannelDetails& ch) override { return getChannel(channel_idx, ch); }
|
||||
|
||||
private:
|
||||
void writeOKFrame();
|
||||
void writeErrFrame(uint8_t err_code);
|
||||
void writeDisabledFrame();
|
||||
void writeContactRespFrame(uint8_t code, const ContactInfo &contact);
|
||||
void updateContactFromFrame(ContactInfo &contact, const uint8_t *frame, int len);
|
||||
void addToOfflineQueue(const uint8_t frame[], int len);
|
||||
int getFromOfflineQueue(uint8_t frame[]);
|
||||
int getBlobByKey(const uint8_t key[], int key_len, uint8_t dest_buf[]) override {
|
||||
return _store->getBlobByKey(key, key_len, dest_buf);
|
||||
}
|
||||
bool putBlobByKey(const uint8_t key[], int key_len, const uint8_t src_buf[], int len) override {
|
||||
return _store->putBlobByKey(key, key_len, src_buf, len);
|
||||
}
|
||||
|
||||
void checkCLIRescueCmd();
|
||||
void checkSerialInterface();
|
||||
|
||||
// helpers, short-cuts
|
||||
void savePrefs() { _store->savePrefs(_prefs, sensors.node_lat, sensors.node_lon); }
|
||||
void saveChannels() { _store->saveChannels(this); }
|
||||
void saveContacts() { _store->saveContacts(this); }
|
||||
|
||||
private:
|
||||
DataStore* _store;
|
||||
NodePrefs _prefs;
|
||||
uint32_t pending_login;
|
||||
uint32_t pending_status;
|
||||
uint32_t pending_telemetry;
|
||||
BaseSerialInterface *_serial;
|
||||
|
||||
ContactsIterator _iter;
|
||||
uint32_t _iter_filter_since;
|
||||
uint32_t _most_recent_lastmod;
|
||||
uint32_t _active_ble_pin;
|
||||
bool _iter_started;
|
||||
bool _cli_rescue;
|
||||
char cli_command[80];
|
||||
uint8_t app_target_ver;
|
||||
uint8_t *sign_data;
|
||||
uint32_t sign_data_len;
|
||||
unsigned long dirty_contacts_expiry;
|
||||
|
||||
uint8_t cmd_frame[MAX_FRAME_SIZE + 1];
|
||||
uint8_t out_frame[MAX_FRAME_SIZE + 1];
|
||||
CayenneLPP telemetry;
|
||||
|
||||
struct Frame {
|
||||
uint8_t len;
|
||||
uint8_t buf[MAX_FRAME_SIZE];
|
||||
};
|
||||
int offline_queue_len;
|
||||
Frame offline_queue[OFFLINE_QUEUE_SIZE];
|
||||
|
||||
struct AckTableEntry {
|
||||
unsigned long msg_sent;
|
||||
uint32_t ack;
|
||||
};
|
||||
#define EXPECTED_ACK_TABLE_SIZE 8
|
||||
AckTableEntry expected_ack_table[EXPECTED_ACK_TABLE_SIZE]; // circular table
|
||||
int next_ack_idx;
|
||||
|
||||
struct AdvertPath {
|
||||
uint8_t pubkey_prefix[7];
|
||||
uint8_t path_len;
|
||||
uint32_t recv_timestamp;
|
||||
uint8_t path[MAX_PATH_SIZE];
|
||||
};
|
||||
#define ADVERT_PATH_TABLE_SIZE 16
|
||||
AdvertPath advert_paths[ADVERT_PATH_TABLE_SIZE]; // circular table
|
||||
};
|
||||
|
||||
extern MyMesh the_mesh;
|
||||
#ifdef DISPLAY_CLASS
|
||||
extern UITask ui_task;
|
||||
#endif
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
#include <cstdint> // For uint8_t, uint32_t
|
||||
|
||||
#define TELEM_MODE_DENY 0
|
||||
#define TELEM_MODE_ALLOW_FLAGS 1 // use contact.flags
|
||||
#define TELEM_MODE_ALLOW_ALL 2
|
||||
|
||||
#define ADVERT_LOC_NONE 0
|
||||
#define ADVERT_LOC_SHARE 1
|
||||
|
||||
struct NodePrefs { // persisted to file
|
||||
float airtime_factor;
|
||||
char node_name[32];
|
||||
float freq;
|
||||
uint8_t sf;
|
||||
uint8_t cr;
|
||||
uint8_t reserved1;
|
||||
uint8_t manual_add_contacts;
|
||||
float bw;
|
||||
uint8_t tx_power_dbm;
|
||||
uint8_t telemetry_mode_base;
|
||||
uint8_t telemetry_mode_loc;
|
||||
uint8_t telemetry_mode_env;
|
||||
float rx_delay_base;
|
||||
uint32_t ble_pin;
|
||||
uint8_t advert_loc_policy;
|
||||
};
|
||||
@@ -0,0 +1,428 @@
|
||||
#include "UITask.h"
|
||||
#include <Arduino.h>
|
||||
#include <helpers/TxtDataHelpers.h>
|
||||
#include "NodePrefs.h"
|
||||
#include "MyMesh.h"
|
||||
|
||||
#define AUTO_OFF_MILLIS 15000 // 15 seconds
|
||||
#define BOOT_SCREEN_MILLIS 3000 // 3 seconds
|
||||
|
||||
#ifdef PIN_STATUS_LED
|
||||
#define LED_ON_MILLIS 20
|
||||
#define LED_ON_MSG_MILLIS 200
|
||||
#define LED_CYCLE_MILLIS 4000
|
||||
#endif
|
||||
|
||||
#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, SensorManager* sensors, NodePrefs* node_prefs) {
|
||||
_display = display;
|
||||
_sensors = sensors;
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||
clearMsgPreview();
|
||||
_node_prefs = node_prefs;
|
||||
if (_display != NULL) {
|
||||
_display->turnOn();
|
||||
}
|
||||
|
||||
// strip off dash and commit hash by changing dash to null terminator
|
||||
// e.g: v1.2.3-abcdef -> v1.2.3
|
||||
char *version = strdup(FIRMWARE_VERSION);
|
||||
char *dash = strchr(version, '-');
|
||||
if (dash) {
|
||||
*dash = 0;
|
||||
}
|
||||
|
||||
// v1.2.3 (1 Jan 2025)
|
||||
sprintf(_version_info, "%s (%s)", version, FIRMWARE_BUILD_DATE);
|
||||
|
||||
#ifdef PIN_BUZZER
|
||||
buzzer.begin();
|
||||
#endif
|
||||
|
||||
// Initialize digital button if available
|
||||
#ifdef PIN_USER_BTN
|
||||
_userButton = new Button(PIN_USER_BTN, USER_BTN_PRESSED);
|
||||
_userButton->begin();
|
||||
|
||||
// Set up digital button callbacks
|
||||
_userButton->onShortPress([this]() { handleButtonShortPress(); });
|
||||
_userButton->onDoublePress([this]() { handleButtonDoublePress(); });
|
||||
_userButton->onTriplePress([this]() { handleButtonTriplePress(); });
|
||||
_userButton->onQuadruplePress([this]() { handleButtonQuadruplePress(); });
|
||||
_userButton->onLongPress([this]() { handleButtonLongPress(); });
|
||||
_userButton->onAnyPress([this]() { handleButtonAnyPress(); });
|
||||
#endif
|
||||
|
||||
// Initialize analog button if available
|
||||
#ifdef PIN_USER_BTN_ANA
|
||||
_userButtonAnalog = new Button(PIN_USER_BTN_ANA, USER_BTN_PRESSED, true, 20);
|
||||
_userButtonAnalog->begin();
|
||||
|
||||
// Set up analog button callbacks
|
||||
_userButtonAnalog->onShortPress([this]() { handleButtonShortPress(); });
|
||||
_userButtonAnalog->onDoublePress([this]() { handleButtonDoublePress(); });
|
||||
_userButtonAnalog->onTriplePress([this]() { handleButtonTriplePress(); });
|
||||
_userButtonAnalog->onQuadruplePress([this]() { handleButtonQuadruplePress(); });
|
||||
_userButtonAnalog->onLongPress([this]() { handleButtonLongPress(); });
|
||||
_userButtonAnalog->onAnyPress([this]() { handleButtonAnyPress(); });
|
||||
#endif
|
||||
ui_started_at = millis();
|
||||
}
|
||||
|
||||
void UITask::soundBuzzer(UIEventType bet) {
|
||||
#if defined(PIN_BUZZER)
|
||||
switch(bet){
|
||||
case UIEventType::contactMessage:
|
||||
// gemini's pick
|
||||
buzzer.play("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7");
|
||||
break;
|
||||
case UIEventType::channelMessage:
|
||||
buzzer.play("kerplop:d=16,o=6,b=120:32g#,32c#");
|
||||
break;
|
||||
case UIEventType::ack:
|
||||
buzzer.play("ack:d=32,o=8,b=120:c");
|
||||
break;
|
||||
case UIEventType::roomMessage:
|
||||
case UIEventType::newContactMessage:
|
||||
case UIEventType::none:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
// Serial.print("DBG: Buzzzzzz -> ");
|
||||
// Serial.println((int) bet);
|
||||
}
|
||||
|
||||
void UITask::msgRead(int msgcount) {
|
||||
_msgcount = msgcount;
|
||||
if (msgcount == 0) {
|
||||
clearMsgPreview();
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::clearMsgPreview() {
|
||||
_origin[0] = 0;
|
||||
_msg[0] = 0;
|
||||
_need_refresh = true;
|
||||
}
|
||||
|
||||
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
|
||||
_need_refresh = true;
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::renderBatteryIndicator(uint16_t batteryMilliVolts) {
|
||||
// Convert millivolts to percentage
|
||||
const int minMilliVolts = 3000; // Minimum voltage (e.g., 3.0V)
|
||||
const int maxMilliVolts = 4200; // Maximum voltage (e.g., 4.2V)
|
||||
int batteryPercentage = ((batteryMilliVolts - minMilliVolts) * 100) / (maxMilliVolts - minMilliVolts);
|
||||
if (batteryPercentage < 0) batteryPercentage = 0; // Clamp to 0%
|
||||
if (batteryPercentage > 100) batteryPercentage = 100; // Clamp to 100%
|
||||
|
||||
// battery icon
|
||||
int iconWidth = 24;
|
||||
int iconHeight = 12;
|
||||
int iconX = _display->width() - iconWidth - 5; // Position the icon near the top-right corner
|
||||
int iconY = 0;
|
||||
_display->setColor(DisplayDriver::GREEN);
|
||||
|
||||
// battery outline
|
||||
_display->drawRect(iconX, iconY, iconWidth, iconHeight);
|
||||
|
||||
// battery "cap"
|
||||
_display->fillRect(iconX + iconWidth, iconY + (iconHeight / 4), 3, iconHeight / 2);
|
||||
|
||||
// fill the battery based on the percentage
|
||||
int fillWidth = (batteryPercentage * (iconWidth - 4)) / 100;
|
||||
_display->fillRect(iconX + 2, iconY + 2, fillWidth, iconHeight - 4);
|
||||
}
|
||||
|
||||
void UITask::renderCurrScreen() {
|
||||
if (_display == NULL) return; // assert() ??
|
||||
|
||||
char tmp[80];
|
||||
if (_alert[0]) {
|
||||
_display->setTextSize(1.4);
|
||||
uint16_t textWidth = _display->getTextWidth(_alert);
|
||||
_display->setCursor((_display->width() - textWidth) / 2, 22);
|
||||
_display->setColor(DisplayDriver::GREEN);
|
||||
_display->print(_alert);
|
||||
_alert[0] = 0;
|
||||
_need_refresh = true;
|
||||
return;
|
||||
} else if (_origin[0] && _msg[0]) { // message preview
|
||||
// render message preview
|
||||
_display->setCursor(0, 0);
|
||||
_display->setTextSize(1);
|
||||
_display->setColor(DisplayDriver::GREEN);
|
||||
_display->print(_node_prefs->node_name);
|
||||
|
||||
_display->setCursor(0, 12);
|
||||
_display->setColor(DisplayDriver::YELLOW);
|
||||
_display->print(_origin);
|
||||
_display->setCursor(0, 24);
|
||||
_display->setColor(DisplayDriver::LIGHT);
|
||||
_display->print(_msg);
|
||||
|
||||
_display->setCursor(_display->width() - 28, 9);
|
||||
_display->setTextSize(2);
|
||||
_display->setColor(DisplayDriver::ORANGE);
|
||||
sprintf(tmp, "%d", _msgcount);
|
||||
_display->print(tmp);
|
||||
_display->setColor(DisplayDriver::YELLOW); // last color will be kept on T114
|
||||
} else if ((millis() - ui_started_at) < BOOT_SCREEN_MILLIS) { // boot screen
|
||||
// meshcore logo
|
||||
_display->setColor(DisplayDriver::BLUE);
|
||||
int logoWidth = 128;
|
||||
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
|
||||
|
||||
// version info
|
||||
_display->setColor(DisplayDriver::LIGHT);
|
||||
_display->setTextSize(1);
|
||||
uint16_t textWidth = _display->getTextWidth(_version_info);
|
||||
_display->setCursor((_display->width() - textWidth) / 2, 22);
|
||||
_display->print(_version_info);
|
||||
} else { // home screen
|
||||
// node name
|
||||
_display->setCursor(0, 0);
|
||||
_display->setTextSize(1);
|
||||
_display->setColor(DisplayDriver::GREEN);
|
||||
_display->print(_node_prefs->node_name);
|
||||
|
||||
// battery voltage
|
||||
renderBatteryIndicator(_board->getBattMilliVolts());
|
||||
|
||||
// freq / sf
|
||||
_display->setCursor(0, 20);
|
||||
_display->setColor(DisplayDriver::YELLOW);
|
||||
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
|
||||
_display->print(tmp);
|
||||
|
||||
// bw / cr
|
||||
_display->setCursor(0, 30);
|
||||
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
|
||||
_display->print(tmp);
|
||||
|
||||
// BT pin
|
||||
if (!_connected && the_mesh.getBLEPin() != 0) {
|
||||
_display->setColor(DisplayDriver::RED);
|
||||
_display->setTextSize(2);
|
||||
_display->setCursor(0, 43);
|
||||
sprintf(tmp, "Pin:%d", the_mesh.getBLEPin());
|
||||
_display->print(tmp);
|
||||
_display->setColor(DisplayDriver::GREEN);
|
||||
} else {
|
||||
_display->setColor(DisplayDriver::LIGHT);
|
||||
}
|
||||
}
|
||||
_need_refresh = false;
|
||||
}
|
||||
|
||||
void UITask::userLedHandler() {
|
||||
#ifdef PIN_STATUS_LED
|
||||
static int state = 0;
|
||||
static int next_change = 0;
|
||||
static int last_increment = 0;
|
||||
|
||||
int cur_time = millis();
|
||||
if (cur_time > next_change) {
|
||||
if (state == 0) {
|
||||
state = 1;
|
||||
if (_msgcount > 0) {
|
||||
last_increment = LED_ON_MSG_MILLIS;
|
||||
} else {
|
||||
last_increment = LED_ON_MILLIS;
|
||||
}
|
||||
next_change = cur_time + last_increment;
|
||||
} else {
|
||||
state = 0;
|
||||
next_change = cur_time + LED_CYCLE_MILLIS - last_increment;
|
||||
}
|
||||
digitalWrite(PIN_STATUS_LED, state);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
hardware-agnostic pre-shutdown activity should be done here
|
||||
*/
|
||||
void UITask::shutdown(bool restart){
|
||||
|
||||
#ifdef PIN_BUZZER
|
||||
/* note: we have a choice here -
|
||||
we can do a blocking buzzer.loop() with non-deterministic consequences
|
||||
or we can set a flag and delay the shutdown for a couple of seconds
|
||||
while a non-blocking buzzer.loop() plays out in UITask::loop()
|
||||
*/
|
||||
buzzer.shutdown();
|
||||
uint32_t buzzer_timer = millis(); // fail-safe shutdown
|
||||
while (buzzer.isPlaying() && (millis() - 2500) < buzzer_timer)
|
||||
buzzer.loop();
|
||||
|
||||
#endif // PIN_BUZZER
|
||||
|
||||
if (restart)
|
||||
_board->reboot();
|
||||
else
|
||||
_board->powerOff();
|
||||
}
|
||||
|
||||
void UITask::loop() {
|
||||
#ifdef PIN_USER_BTN
|
||||
if (_userButton) {
|
||||
_userButton->update();
|
||||
}
|
||||
#endif
|
||||
#ifdef PIN_USER_BTN_ANA
|
||||
if (_userButtonAnalog) {
|
||||
_userButtonAnalog->update();
|
||||
}
|
||||
#endif
|
||||
userLedHandler();
|
||||
|
||||
#ifdef PIN_BUZZER
|
||||
if (buzzer.isPlaying()) buzzer.loop();
|
||||
#endif
|
||||
|
||||
if (_display != NULL && _display->isOn()) {
|
||||
static bool _firstBoot = true;
|
||||
if(_firstBoot && (millis() - ui_started_at) >= BOOT_SCREEN_MILLIS) {
|
||||
_need_refresh = true;
|
||||
_firstBoot = false;
|
||||
}
|
||||
if (millis() >= _next_refresh && _need_refresh) {
|
||||
_display->startFrame();
|
||||
renderCurrScreen();
|
||||
_display->endFrame();
|
||||
|
||||
_next_refresh = millis() + 1000; // refresh every second
|
||||
}
|
||||
if (millis() > _auto_off) {
|
||||
_display->turnOff();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::handleButtonAnyPress() {
|
||||
MESH_DEBUG_PRINTLN("UITask: any press triggered");
|
||||
// called on any button press before other events, to wake up the display quickly
|
||||
// do not refresh the display here, as it may block the button handler
|
||||
if (_display != NULL) {
|
||||
_displayWasOn = _display->isOn(); // Track display state before any action
|
||||
if (!_displayWasOn) {
|
||||
_display->turnOn();
|
||||
}
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::handleButtonShortPress() {
|
||||
MESH_DEBUG_PRINTLN("UITask: short press triggered");
|
||||
if (_display != NULL) {
|
||||
// Only clear message preview if display was already on before button press
|
||||
if (_displayWasOn) {
|
||||
// If display was on and showing message preview, clear it
|
||||
if (_origin[0] && _msg[0]) {
|
||||
clearMsgPreview();
|
||||
} else {
|
||||
// Otherwise, refresh the display
|
||||
_need_refresh = true;
|
||||
}
|
||||
} else {
|
||||
_need_refresh = true; // display just turned on, so we need to refresh
|
||||
}
|
||||
// Note: Display turn-on and auto-off timer extension are handled by handleButtonAnyPress
|
||||
}
|
||||
}
|
||||
|
||||
void UITask::handleButtonDoublePress() {
|
||||
MESH_DEBUG_PRINTLN("UITask: double press triggered, sending advert");
|
||||
// ADVERT
|
||||
#ifdef PIN_BUZZER
|
||||
soundBuzzer(UIEventType::ack);
|
||||
#endif
|
||||
if (the_mesh.advert()) {
|
||||
MESH_DEBUG_PRINTLN("Advert sent!");
|
||||
sprintf(_alert, "Advert sent!");
|
||||
} else {
|
||||
MESH_DEBUG_PRINTLN("Advert failed!");
|
||||
sprintf(_alert, "Advert failed..");
|
||||
}
|
||||
_need_refresh = true;
|
||||
}
|
||||
|
||||
void UITask::handleButtonTriplePress() {
|
||||
MESH_DEBUG_PRINTLN("UITask: triple press triggered");
|
||||
// Toggle buzzer quiet mode
|
||||
#ifdef PIN_BUZZER
|
||||
if (buzzer.isQuiet()) {
|
||||
buzzer.quiet(false);
|
||||
soundBuzzer(UIEventType::ack);
|
||||
sprintf(_alert, "Buzzer: ON");
|
||||
} else {
|
||||
buzzer.quiet(true);
|
||||
sprintf(_alert, "Buzzer: OFF");
|
||||
}
|
||||
_need_refresh = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void UITask::handleButtonQuadruplePress() {
|
||||
MESH_DEBUG_PRINTLN("UITask: quad press triggered");
|
||||
if (_sensors != NULL) {
|
||||
// toggle GPS onn/off
|
||||
int num = _sensors->getNumSettings();
|
||||
for (int i = 0; i < num; i++) {
|
||||
if (strcmp(_sensors->getSettingName(i), "gps") == 0) {
|
||||
if (strcmp(_sensors->getSettingValue(i), "1") == 0) {
|
||||
_sensors->setSettingValue("gps", "0");
|
||||
} else {
|
||||
_sensors->setSettingValue("gps", "1");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_need_refresh = true;
|
||||
}
|
||||
|
||||
void UITask::handleButtonLongPress() {
|
||||
MESH_DEBUG_PRINTLN("UITask: long press triggered");
|
||||
if (millis() - ui_started_at < 8000) { // long press in first 8 seconds since startup -> CLI/rescue
|
||||
the_mesh.enterCLIRescue();
|
||||
} else {
|
||||
shutdown();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
#pragma once
|
||||
|
||||
#include <MeshCore.h>
|
||||
#include <helpers/ui/DisplayDriver.h>
|
||||
#include <helpers/SensorManager.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef PIN_BUZZER
|
||||
#include <helpers/ui/buzzer.h>
|
||||
#endif
|
||||
|
||||
#include "NodePrefs.h"
|
||||
#include "Button.h"
|
||||
|
||||
enum class UIEventType
|
||||
{
|
||||
none,
|
||||
contactMessage,
|
||||
channelMessage,
|
||||
roomMessage,
|
||||
newContactMessage,
|
||||
ack
|
||||
};
|
||||
|
||||
class UITask {
|
||||
DisplayDriver* _display;
|
||||
mesh::MainBoard* _board;
|
||||
SensorManager* _sensors;
|
||||
#ifdef PIN_BUZZER
|
||||
genericBuzzer buzzer;
|
||||
#endif
|
||||
unsigned long _next_refresh, _auto_off;
|
||||
bool _connected;
|
||||
NodePrefs* _node_prefs;
|
||||
char _version_info[32];
|
||||
char _origin[62];
|
||||
char _msg[80];
|
||||
char _alert[80];
|
||||
int _msgcount;
|
||||
bool _need_refresh = true;
|
||||
bool _displayWasOn = false; // Track display state before button press
|
||||
unsigned long ui_started_at;
|
||||
|
||||
// Button handlers
|
||||
#ifdef PIN_USER_BTN
|
||||
Button* _userButton = nullptr;
|
||||
#endif
|
||||
#ifdef PIN_USER_BTN_ANA
|
||||
Button* _userButtonAnalog = nullptr;
|
||||
#endif
|
||||
|
||||
void renderCurrScreen();
|
||||
void userLedHandler();
|
||||
void renderBatteryIndicator(uint16_t batteryMilliVolts);
|
||||
|
||||
// Button action handlers
|
||||
void handleButtonAnyPress();
|
||||
void handleButtonShortPress();
|
||||
void handleButtonDoublePress();
|
||||
void handleButtonTriplePress();
|
||||
void handleButtonQuadruplePress();
|
||||
void handleButtonLongPress();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
UITask(mesh::MainBoard* board) : _board(board), _display(NULL), _sensors(NULL) {
|
||||
_next_refresh = 0;
|
||||
ui_started_at = 0;
|
||||
_connected = false;
|
||||
}
|
||||
void begin(DisplayDriver* display, SensorManager* sensors, NodePrefs* node_prefs);
|
||||
|
||||
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 soundBuzzer(UIEventType bet = UIEventType::none);
|
||||
void shutdown(bool restart = false);
|
||||
void loop();
|
||||
};
|
||||
@@ -0,0 +1,199 @@
|
||||
#include <Arduino.h> // needed for PlatformIO
|
||||
#include <Mesh.h>
|
||||
#include "MyMesh.h"
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
#include <InternalFileSystem.h>
|
||||
DataStore store(InternalFS, rtc_clock);
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
#include <LittleFS.h>
|
||||
DataStore store(LittleFS, rtc_clock);
|
||||
#elif defined(ESP32)
|
||||
#include <SPIFFS.h>
|
||||
DataStore store(SPIFFS, rtc_clock);
|
||||
#endif
|
||||
|
||||
#ifdef ESP32
|
||||
#ifdef WIFI_SSID
|
||||
#include <helpers/esp32/SerialWifiInterface.h>
|
||||
SerialWifiInterface serial_interface;
|
||||
#ifndef TCP_PORT
|
||||
#define TCP_PORT 5000
|
||||
#endif
|
||||
#elif defined(BLE_PIN_CODE)
|
||||
#include <helpers/esp32/SerialBLEInterface.h>
|
||||
SerialBLEInterface serial_interface;
|
||||
#elif defined(SERIAL_RX)
|
||||
#include <helpers/ArduinoSerialInterface.h>
|
||||
ArduinoSerialInterface serial_interface;
|
||||
HardwareSerial companion_serial(1);
|
||||
#else
|
||||
#include <helpers/ArduinoSerialInterface.h>
|
||||
ArduinoSerialInterface serial_interface;
|
||||
#endif
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
//#ifdef WIFI_SSID
|
||||
// #include <helpers/rp2040/SerialWifiInterface.h>
|
||||
// SerialWifiInterface serial_interface;
|
||||
// #ifndef TCP_PORT
|
||||
// #define TCP_PORT 5000
|
||||
// #endif
|
||||
// #elif defined(BLE_PIN_CODE)
|
||||
// #include <helpers/rp2040/SerialBLEInterface.h>
|
||||
// SerialBLEInterface serial_interface;
|
||||
#if defined(SERIAL_RX)
|
||||
#include <helpers/ArduinoSerialInterface.h>
|
||||
ArduinoSerialInterface serial_interface;
|
||||
HardwareSerial companion_serial(1);
|
||||
#else
|
||||
#include <helpers/ArduinoSerialInterface.h>
|
||||
ArduinoSerialInterface serial_interface;
|
||||
#endif
|
||||
#elif defined(NRF52_PLATFORM)
|
||||
#ifdef BLE_PIN_CODE
|
||||
#include <helpers/nrf52/SerialBLEInterface.h>
|
||||
SerialBLEInterface serial_interface;
|
||||
#else
|
||||
#include <helpers/ArduinoSerialInterface.h>
|
||||
ArduinoSerialInterface serial_interface;
|
||||
#endif
|
||||
#elif defined(STM32_PLATFORM)
|
||||
#include <helpers/ArduinoSerialInterface.h>
|
||||
ArduinoSerialInterface serial_interface;
|
||||
#else
|
||||
#error "need to define a serial interface"
|
||||
#endif
|
||||
|
||||
/* GLOBAL OBJECTS */
|
||||
StdRNG fast_rng;
|
||||
SimpleMeshTables tables;
|
||||
MyMesh the_mesh(radio_driver, fast_rng, rtc_clock, tables, store);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
#include "UITask.h"
|
||||
UITask ui_task(&board);
|
||||
#endif
|
||||
/* END GLOBAL OBJECTS */
|
||||
|
||||
void halt() {
|
||||
while (1) ;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
|
||||
board.begin();
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
DisplayDriver* disp = NULL;
|
||||
if (display.begin()) {
|
||||
disp = &display;
|
||||
disp->startFrame();
|
||||
disp->print("Please wait...");
|
||||
disp->endFrame();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!radio_init()) { halt(); }
|
||||
|
||||
fast_rng.begin(radio_get_rng_seed());
|
||||
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
InternalFS.begin();
|
||||
store.begin();
|
||||
the_mesh.begin(
|
||||
#ifdef DISPLAY_CLASS
|
||||
disp != NULL
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
|
||||
#ifdef BLE_PIN_CODE
|
||||
char dev_name[32+16];
|
||||
sprintf(dev_name, "%s%s", BLE_NAME_PREFIX, the_mesh.getNodeName());
|
||||
serial_interface.begin(dev_name, the_mesh.getBLEPin());
|
||||
#else
|
||||
serial_interface.begin(Serial);
|
||||
#endif
|
||||
the_mesh.startInterface(serial_interface);
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
LittleFS.begin();
|
||||
store.begin();
|
||||
the_mesh.begin(
|
||||
#ifdef DISPLAY_CLASS
|
||||
disp != NULL
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
|
||||
//#ifdef WIFI_SSID
|
||||
// WiFi.begin(WIFI_SSID, WIFI_PWD);
|
||||
// serial_interface.begin(TCP_PORT);
|
||||
// #elif defined(BLE_PIN_CODE)
|
||||
// char dev_name[32+16];
|
||||
// sprintf(dev_name, "%s%s", BLE_NAME_PREFIX, the_mesh.getNodeName());
|
||||
// serial_interface.begin(dev_name, the_mesh.getBLEPin());
|
||||
#if defined(SERIAL_RX)
|
||||
companion_serial.setPins(SERIAL_RX, SERIAL_TX);
|
||||
companion_serial.begin(115200);
|
||||
serial_interface.begin(companion_serial);
|
||||
#else
|
||||
serial_interface.begin(Serial);
|
||||
#endif
|
||||
the_mesh.startInterface(serial_interface);
|
||||
#elif defined(ESP32)
|
||||
SPIFFS.begin(true);
|
||||
store.begin();
|
||||
the_mesh.begin(
|
||||
#ifdef DISPLAY_CLASS
|
||||
disp != NULL
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
);
|
||||
|
||||
#ifdef WIFI_SSID
|
||||
WiFi.begin(WIFI_SSID, WIFI_PWD);
|
||||
serial_interface.begin(TCP_PORT);
|
||||
#elif defined(BLE_PIN_CODE)
|
||||
char dev_name[32+16];
|
||||
sprintf(dev_name, "%s%s", BLE_NAME_PREFIX, the_mesh.getNodeName());
|
||||
serial_interface.begin(dev_name, the_mesh.getBLEPin());
|
||||
#elif defined(SERIAL_RX)
|
||||
companion_serial.setPins(SERIAL_RX, SERIAL_TX);
|
||||
companion_serial.begin(115200);
|
||||
serial_interface.begin(companion_serial);
|
||||
#else
|
||||
serial_interface.begin(Serial);
|
||||
#endif
|
||||
the_mesh.startInterface(serial_interface);
|
||||
#else
|
||||
#error "need to define filesystem"
|
||||
#endif
|
||||
|
||||
sensors.begin();
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
ui_task.begin(disp, &sensors, the_mesh.getNodePrefs()); // still want to pass this in as dependency, as prefs might be moved
|
||||
#endif
|
||||
}
|
||||
|
||||
void loop() {
|
||||
the_mesh.loop();
|
||||
sensors.loop();
|
||||
#ifdef DISPLAY_CLASS
|
||||
ui_task.loop();
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
#include "UITask.h"
|
||||
#include <Arduino.h>
|
||||
#include <helpers/CommonCLI.h>
|
||||
|
||||
#define AUTO_OFF_MILLIS 20000 // 20 seconds
|
||||
#define BOOT_SCREEN_MILLIS 4000 // 4 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(NodePrefs* node_prefs, const char* build_date, const char* firmware_version) {
|
||||
_prevBtnState = HIGH;
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||
_node_prefs = node_prefs;
|
||||
_display->turnOn();
|
||||
|
||||
// strip off dash and commit hash by changing dash to null terminator
|
||||
// e.g: v1.2.3-abcdef -> v1.2.3
|
||||
char *version = strdup(firmware_version);
|
||||
char *dash = strchr(version, '-');
|
||||
if(dash){
|
||||
*dash = 0;
|
||||
}
|
||||
|
||||
// v1.2.3 (1 Jan 2025)
|
||||
sprintf(_version_info, "%s (%s)", version, build_date);
|
||||
}
|
||||
|
||||
void UITask::renderCurrScreen() {
|
||||
char tmp[80];
|
||||
if (millis() < BOOT_SCREEN_MILLIS) { // boot screen
|
||||
// meshcore logo
|
||||
_display->setColor(DisplayDriver::BLUE);
|
||||
int logoWidth = 128;
|
||||
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
|
||||
|
||||
// version info
|
||||
_display->setColor(DisplayDriver::LIGHT);
|
||||
_display->setTextSize(1);
|
||||
uint16_t versionWidth = _display->getTextWidth(_version_info);
|
||||
_display->setCursor((_display->width() - versionWidth) / 2, 22);
|
||||
_display->print(_version_info);
|
||||
|
||||
// node type
|
||||
const char* node_type = "< Repeater >";
|
||||
uint16_t typeWidth = _display->getTextWidth(node_type);
|
||||
_display->setCursor((_display->width() - typeWidth) / 2, 35);
|
||||
_display->print(node_type);
|
||||
} else { // home screen
|
||||
// node name
|
||||
_display->setCursor(0, 0);
|
||||
_display->setTextSize(1);
|
||||
_display->setColor(DisplayDriver::GREEN);
|
||||
_display->print(_node_prefs->node_name);
|
||||
|
||||
// freq / sf
|
||||
_display->setCursor(0, 20);
|
||||
_display->setColor(DisplayDriver::YELLOW);
|
||||
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
|
||||
_display->print(tmp);
|
||||
|
||||
// bw / cr
|
||||
_display->setCursor(0, 30);
|
||||
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
|
||||
_display->print(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
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,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <helpers/ui/DisplayDriver.h>
|
||||
#include <helpers/CommonCLI.h>
|
||||
|
||||
class UITask {
|
||||
DisplayDriver* _display;
|
||||
unsigned long _next_read, _next_refresh, _auto_off;
|
||||
int _prevBtnState;
|
||||
NodePrefs* _node_prefs;
|
||||
char _version_info[32];
|
||||
|
||||
void renderCurrScreen();
|
||||
public:
|
||||
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
|
||||
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version);
|
||||
|
||||
void loop();
|
||||
};
|
||||
@@ -0,0 +1,830 @@
|
||||
#include <Arduino.h> // needed for PlatformIO
|
||||
#include <Mesh.h>
|
||||
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
#include <InternalFileSystem.h>
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
#include <LittleFS.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 "29 Jun 2025"
|
||||
#endif
|
||||
|
||||
#ifndef FIRMWARE_VERSION
|
||||
#define FIRMWARE_VERSION "v1.7.1"
|
||||
#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
|
||||
|
||||
#ifndef SERVER_RESPONSE_DELAY
|
||||
#define SERVER_RESPONSE_DELAY 300
|
||||
#endif
|
||||
|
||||
#ifndef TXT_ACK_DELAY
|
||||
#define TXT_ACK_DELAY 200
|
||||
#endif
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
#include "UITask.h"
|
||||
static UITask ui_task(display);
|
||||
#endif
|
||||
|
||||
#define FIRMWARE_ROLE "repeater"
|
||||
|
||||
#define PACKET_LOG_FILE "/packet_log"
|
||||
|
||||
/* ------------------------------ Code -------------------------------- */
|
||||
|
||||
#define REQ_TYPE_GET_STATUS 0x01 // same as _GET_STATS
|
||||
#define REQ_TYPE_KEEP_ALIVE 0x02
|
||||
#define REQ_TYPE_GET_TELEMETRY_DATA 0x03
|
||||
|
||||
#define RESP_SERVER_LOGIN_OK 0 // response to ANON_REQ
|
||||
|
||||
struct RepeaterStats {
|
||||
uint16_t batt_milli_volts;
|
||||
uint16_t curr_tx_queue_len;
|
||||
int16_t noise_floor;
|
||||
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 err_events; // was '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];
|
||||
};
|
||||
|
||||
#ifndef MAX_CLIENTS
|
||||
#define MAX_CLIENTS 32
|
||||
#endif
|
||||
|
||||
struct NeighbourInfo {
|
||||
mesh::Identity id;
|
||||
uint32_t advert_timestamp;
|
||||
uint32_t heard_timestamp;
|
||||
int8_t snr; // multiplied by 4, user should divide to get float value
|
||||
};
|
||||
|
||||
#define CLI_REPLY_DELAY_MILLIS 1000
|
||||
|
||||
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];
|
||||
#if MAX_NEIGHBOURS
|
||||
NeighbourInfo neighbours[MAX_NEIGHBOURS];
|
||||
#endif
|
||||
CayenneLPP telemetry;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void putNeighbour(const mesh::Identity& id, uint32_t timestamp, float snr) {
|
||||
#if MAX_NEIGHBOURS // check if neighbours enabled
|
||||
// find existing neighbour, else use least recently updated
|
||||
uint32_t oldest_timestamp = 0xFFFFFFFF;
|
||||
NeighbourInfo* neighbour = &neighbours[0];
|
||||
for (int i = 0; i < MAX_NEIGHBOURS; i++) {
|
||||
// if neighbour already known, we should update it
|
||||
if (id.matches(neighbours[i].id)) {
|
||||
neighbour = &neighbours[i];
|
||||
break;
|
||||
}
|
||||
|
||||
// otherwise we should update the least recently updated neighbour
|
||||
if (neighbours[i].heard_timestamp < oldest_timestamp) {
|
||||
neighbour = &neighbours[i];
|
||||
oldest_timestamp = neighbour->heard_timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
// update neighbour info
|
||||
neighbour->id = id;
|
||||
neighbour->advert_timestamp = timestamp;
|
||||
neighbour->heard_timestamp = getRTCClock()->getCurrentTime();
|
||||
neighbour->snr = (int8_t) (snr * 4);
|
||||
#endif
|
||||
}
|
||||
|
||||
int handleRequest(ClientInfo* sender, uint32_t sender_timestamp, uint8_t* payload, size_t payload_len) {
|
||||
// uint32_t now = getRTCClock()->getCurrentTimeUnique();
|
||||
// memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
|
||||
memcpy(reply_data, &sender_timestamp, 4); // reflect sender_timestamp back in response packet (kind of like a 'tag')
|
||||
|
||||
switch (payload[0]) {
|
||||
case REQ_TYPE_GET_STATUS: { // guests can also access this now
|
||||
RepeaterStats stats;
|
||||
stats.batt_milli_volts = board.getBattMilliVolts();
|
||||
stats.curr_tx_queue_len = _mgr->getOutboundCount(0xFFFFFFFF);
|
||||
stats.noise_floor = (int16_t)_radio->getNoiseFloor();
|
||||
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.err_events = _err_flags;
|
||||
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
|
||||
}
|
||||
case REQ_TYPE_GET_TELEMETRY_DATA: {
|
||||
telemetry.reset();
|
||||
telemetry.addVoltage(TELEM_CHANNEL_SELF, (float)board.getBattMilliVolts() / 1000.0f);
|
||||
// query other sensors -- target specific
|
||||
sensors.querySensors(sender->is_admin ? 0xFF : 0x00, telemetry);
|
||||
|
||||
uint8_t tlen = telemetry.getSize();
|
||||
memcpy(&reply_data[4], telemetry.getBuffer(), tlen);
|
||||
return 4 + tlen; // reply_len
|
||||
}
|
||||
}
|
||||
return 0; // unknown command
|
||||
}
|
||||
|
||||
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) || defined(STM32_PLATFORM)
|
||||
return _fs->open(fname, FILE_O_WRITE);
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
return _fs->open(fname, "a");
|
||||
#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;
|
||||
}
|
||||
int getInterferenceThreshold() const override {
|
||||
return _prefs.interference_threshold;
|
||||
}
|
||||
int getAGCResetInterval() const override {
|
||||
return ((int)_prefs.agc_reset_interval) * 4000; // milliseconds
|
||||
}
|
||||
|
||||
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, SERVER_RESPONSE_DELAY);
|
||||
} 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, SERVER_RESPONSE_DELAY);
|
||||
} else {
|
||||
sendFlood(reply, SERVER_RESPONSE_DELAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 onAdvertRecv(mesh::Packet* packet, const mesh::Identity& id, uint32_t timestamp, const uint8_t* app_data, size_t app_data_len) {
|
||||
mesh::Mesh::onAdvertRecv(packet, id, timestamp, app_data, app_data_len); // chain to super impl
|
||||
|
||||
// if this a zero hop advert, add it to neighbours
|
||||
if (packet->path_len == 0) {
|
||||
AdvertDataParser parser(app_data, app_data_len);
|
||||
if (parser.isValid() && parser.getType() == ADV_TYPE_REPEATER) { // just keep neigbouring Repeaters
|
||||
putNeighbour(id, timestamp, packet->getSNR());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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, timestamp, &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, SERVER_RESPONSE_DELAY);
|
||||
} 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, SERVER_RESPONSE_DELAY);
|
||||
} else {
|
||||
sendFlood(reply, SERVER_RESPONSE_DELAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
} 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, TXT_ACK_DELAY);
|
||||
} else {
|
||||
sendDirect(ack, client->out_path, client->out_path_len, TXT_ACK_DELAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t temp[166];
|
||||
const char *command = (const char *) &data[5];
|
||||
char *reply = (char *) &temp[5];
|
||||
if (is_retry) {
|
||||
*reply = 0;
|
||||
} else {
|
||||
_cli.handleCommand(sender_timestamp, command, reply);
|
||||
}
|
||||
int text_len = strlen(reply);
|
||||
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, rtc, &_prefs, this), telemetry(MAX_PACKET_PAYLOAD - 4)
|
||||
{
|
||||
memset(known_clients, 0, sizeof(known_clients));
|
||||
next_local_advert = next_flood_advert = 0;
|
||||
_logging = false;
|
||||
|
||||
#if MAX_NEIGHBOURS
|
||||
memset(neighbours, 0, sizeof(neighbours));
|
||||
#endif
|
||||
|
||||
// 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;
|
||||
_prefs.interference_threshold = 0; // disabled
|
||||
}
|
||||
|
||||
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; }
|
||||
NodePrefs* getNodePrefs() {
|
||||
return &_prefs;
|
||||
}
|
||||
|
||||
void savePrefs() override {
|
||||
_cli.savePrefs(_fs);
|
||||
}
|
||||
|
||||
bool formatFileSystem() override {
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
return InternalFS.format();
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
return LittleFS.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 {
|
||||
#if defined(RP2040_PLATFORM)
|
||||
File f = _fs->open(PACKET_LOG_FILE, "r");
|
||||
#else
|
||||
File f = _fs->open(PACKET_LOG_FILE);
|
||||
#endif
|
||||
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 formatNeighborsReply(char *reply) override {
|
||||
char *dp = reply;
|
||||
|
||||
#if MAX_NEIGHBOURS
|
||||
for (int i = 0; i < MAX_NEIGHBOURS && dp - reply < 134; i++) {
|
||||
NeighbourInfo* neighbour = &neighbours[i];
|
||||
if (neighbour->heard_timestamp == 0) continue; // skip empty slots
|
||||
|
||||
// add new line if not first item
|
||||
if (i > 0) *dp++ = '\n';
|
||||
|
||||
char hex[10];
|
||||
// get 4 bytes of neighbour id as hex
|
||||
mesh::Utils::toHex(hex, neighbour->id.pub_key, 4);
|
||||
|
||||
// add next neighbour
|
||||
uint32_t secs_ago = getRTCClock()->getCurrentTime() - neighbour->heard_timestamp;
|
||||
sprintf(dp, "%s:%d:%d", hex, secs_ago, neighbour->snr);
|
||||
while (*dp) dp++; // find end of string
|
||||
}
|
||||
#endif
|
||||
if (dp == reply) { // no neighbours, need empty response
|
||||
strcpy(dp, "-none-"); dp += 6;
|
||||
}
|
||||
*dp = 0; // null terminator
|
||||
}
|
||||
|
||||
const uint8_t* getSelfIdPubKey() override { return self_id.pub_key; }
|
||||
|
||||
void clearStats() override {
|
||||
radio_driver.resetStats();
|
||||
resetStats();
|
||||
((SimpleMeshTables *)getTables())->resetStats();
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
if (display.begin()) {
|
||||
display.startFrame();
|
||||
display.print("Please wait...");
|
||||
display.endFrame();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!radio_init()) { halt(); }
|
||||
|
||||
fast_rng.begin(radio_get_rng_seed());
|
||||
|
||||
FILESYSTEM* fs;
|
||||
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
|
||||
InternalFS.begin();
|
||||
fs = &InternalFS;
|
||||
IdentityStore store(InternalFS, "");
|
||||
#elif defined(ESP32)
|
||||
SPIFFS.begin(true);
|
||||
fs = &SPIFFS;
|
||||
IdentityStore store(SPIFFS, "/identity");
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
LittleFS.begin();
|
||||
fs = &LittleFS;
|
||||
IdentityStore store(LittleFS, "/identity");
|
||||
store.begin();
|
||||
#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
|
||||
int count = 0;
|
||||
while (count < 10 && (the_mesh.self_id.pub_key[0] == 0x00 || the_mesh.self_id.pub_key[0] == 0xFF)) { // reserved id hashes
|
||||
the_mesh.self_id = radio_new_identity(); count++;
|
||||
}
|
||||
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;
|
||||
|
||||
sensors.begin();
|
||||
|
||||
the_mesh.begin(fs);
|
||||
|
||||
#ifdef DISPLAY_CLASS
|
||||
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
|
||||
#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();
|
||||
sensors.loop();
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
#include "UITask.h"
|
||||
#include <Arduino.h>
|
||||
#include <helpers/CommonCLI.h>
|
||||
|
||||
#define AUTO_OFF_MILLIS 20000 // 20 seconds
|
||||
#define BOOT_SCREEN_MILLIS 4000 // 4 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(NodePrefs* node_prefs, const char* build_date, const char* firmware_version) {
|
||||
_prevBtnState = HIGH;
|
||||
_auto_off = millis() + AUTO_OFF_MILLIS;
|
||||
_node_prefs = node_prefs;
|
||||
_display->turnOn();
|
||||
|
||||
// strip off dash and commit hash by changing dash to null terminator
|
||||
// e.g: v1.2.3-abcdef -> v1.2.3
|
||||
char *version = strdup(firmware_version);
|
||||
char *dash = strchr(version, '-');
|
||||
if(dash){
|
||||
*dash = 0;
|
||||
}
|
||||
|
||||
// v1.2.3 (1 Jan 2025)
|
||||
sprintf(_version_info, "%s (%s)", version, build_date);
|
||||
}
|
||||
|
||||
void UITask::renderCurrScreen() {
|
||||
char tmp[80];
|
||||
if (millis() < BOOT_SCREEN_MILLIS) { // boot screen
|
||||
// meshcore logo
|
||||
_display->setColor(DisplayDriver::BLUE);
|
||||
int logoWidth = 128;
|
||||
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
|
||||
|
||||
// version info
|
||||
_display->setColor(DisplayDriver::LIGHT);
|
||||
_display->setTextSize(1);
|
||||
uint16_t versionWidth = _display->getTextWidth(_version_info);
|
||||
_display->setCursor((_display->width() - versionWidth) / 2, 22);
|
||||
_display->print(_version_info);
|
||||
|
||||
// node type
|
||||
const char* node_type = "< Room Server >";
|
||||
uint16_t typeWidth = _display->getTextWidth(node_type);
|
||||
_display->setCursor((_display->width() - typeWidth) / 2, 35);
|
||||
_display->print(node_type);
|
||||
} else { // home screen
|
||||
// node name
|
||||
_display->setCursor(0, 0);
|
||||
_display->setTextSize(1);
|
||||
_display->setColor(DisplayDriver::GREEN);
|
||||
_display->print(_node_prefs->node_name);
|
||||
|
||||
// freq / sf
|
||||
_display->setCursor(0, 20);
|
||||
_display->setColor(DisplayDriver::YELLOW);
|
||||
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
|
||||
_display->print(tmp);
|
||||
|
||||
// bw / cr
|
||||
_display->setCursor(0, 30);
|
||||
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
|
||||
_display->print(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
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,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <helpers/ui/DisplayDriver.h>
|
||||
#include <helpers/CommonCLI.h>
|
||||
|
||||
class UITask {
|
||||
DisplayDriver* _display;
|
||||
unsigned long _next_read, _next_refresh, _auto_off;
|
||||
int _prevBtnState;
|
||||
NodePrefs* _node_prefs;
|
||||
char _version_info[32];
|
||||
|
||||
void renderCurrScreen();
|
||||
public:
|
||||
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
|
||||
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version);
|
||||
|
||||
void loop();
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,590 @@
|
||||
#include <Arduino.h> // needed for PlatformIO
|
||||
#include <Mesh.h>
|
||||
|
||||
#if defined(NRF52_PLATFORM)
|
||||
#include <InternalFileSystem.h>
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
#include <LittleFS.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")) {
|
||||
#if defined(RP2040_PLATFORM)
|
||||
File file = _fs->open("/contacts", "r");
|
||||
#else
|
||||
File file = _fs->open("/contacts");
|
||||
#endif
|
||||
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)
|
||||
_fs->remove("/contacts");
|
||||
File file = _fs->open("/contacts", FILE_O_WRITE);
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
File file = _fs->open("/contacts", "w");
|
||||
#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, uint8_t path_len, const uint8_t* path) 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);
|
||||
}
|
||||
|
||||
uint8_t onContactRequest(const ContactInfo& contact, uint32_t sender_timestamp, const uint8_t* data, uint8_t len, uint8_t* reply) override {
|
||||
return 0; // unknown
|
||||
}
|
||||
|
||||
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, "");
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
IdentityStore store(fs, "/identity");
|
||||
store.begin();
|
||||
#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
|
||||
int count = 0;
|
||||
while (count < 10 && (self_id.pub_key[0] == 0x00 || self_id.pub_key[0] == 0xFF)) { // reserved id hashes
|
||||
self_id = mesh::LocalIdentity(getRNG()); count++;
|
||||
}
|
||||
store.save("_main", self_id);
|
||||
}
|
||||
|
||||
// load persisted prefs
|
||||
if (_fs->exists("/node_prefs")) {
|
||||
#if defined(RP2040_PLATFORM)
|
||||
File file = _fs->open("/node_prefs", "r");
|
||||
#else
|
||||
File file = _fs->open("/node_prefs");
|
||||
#endif
|
||||
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)
|
||||
_fs->remove("/node_prefs");
|
||||
File file = _fs->open("/node_prefs", FILE_O_WRITE);
|
||||
#elif defined(RP2040_PLATFORM)
|
||||
File file = _fs->open("/node_prefs", "w");
|
||||
#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(RP2040_PLATFORM)
|
||||
LittleFS.begin();
|
||||
the_mesh.begin(LittleFS);
|
||||
#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
|
||||
-895
@@ -1,895 +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></code>, <code>fairness cap</code>, <code>fairness refill</code>, <code>fairness grid</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 <hours></code>, <code>fairness advert 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 <name></code>, <code>filter del <name></code>, <code>filter 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 <minutes></code> / <code>filter age 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 <mV></code> and <code>set batt.icon.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>set radio.rxps level <level></code> 1-10; 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></code> or <code>off</code> (default 3300; below it the node does not start
|
||||
and sleeps until the cell recovers) and <code>set pwr.cutoff <mV></code> or <code>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 (INA219, INA226,
|
||||
INA3221; the INA260 has it inside) 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>
|
||||
Loaded 100 of 427 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user