Compare commits

...

984 Commits

Author SHA1 Message Date
Kevin Hester
e32202e4f8 Merge pull request #570 from geeksville/dev
Dev
2020-12-17 11:09:19 +08:00
Kevin Hester
ca99b6b3b7 1.1.23 2020-12-17 10:59:05 +08:00
Kevin Hester
2eb2e9142f Merge remote-tracking branch 'root/master' into dev 2020-12-17 10:58:28 +08:00
Kevin Hester
15e1a3870c When new node joins mesh, all other nodes reply with their current state 2020-12-17 10:53:29 +08:00
Kevin Hester
5bdc7216b3 begin support for multiple simultanous channels 2020-12-17 10:32:19 +08:00
Kevin Hester
cc127f7dad Merge pull request #562 from geeksville/dev
Dev
2020-12-15 17:00:42 +08:00
Kevin Hester
be38a58a62 finish channel name cleanup 2020-12-15 16:13:16 +08:00
Kevin Hester
5930f8270d Merge remote-tracking branch 'root/master' into dev 2020-12-15 16:10:35 +08:00
Kevin Hester
c9f2318e78 Use simpler names for standard channels 2020-12-15 13:14:36 +08:00
Kevin Hester
5cdc2f5142 Make ChannelSettings SUPER short for common channels 2020-12-14 21:09:29 +08:00
Jm Casler
53d773b81f Merge pull request #565 from mc-hamster/master
Fixed bad copy/paste of http end points being used as default.
2020-12-13 17:00:43 -08:00
Jm Casler
85b2ba7ce9 Merge branch 'master' into master 2020-12-13 15:02:18 -08:00
Jm Casler
474e0e7158 Fixed bad copy/paste of http end points being used as default. 2020-12-13 14:59:56 -08:00
Jm Casler
99a8c80c44 Merge pull request #564 from mc-hamster/master
#563 Don't display the wifi password when we are a client.
2020-12-13 11:29:21 -08:00
Jm Casler
03a9d7da5e Merge branch 'master' into master 2020-12-13 11:05:40 -08:00
Jm Casler
6975848f45 #563 Don't display the wifi password when we are a client. 2020-12-13 11:01:01 -08:00
Kevin Hester
0cdc1fc959 make gpiowatch work correctly 2020-12-13 16:11:38 +08:00
Kevin Hester
e80c79edbe clean up debug msgs 2020-12-13 15:59:26 +08:00
Jm Casler
651d045afe Merge pull request #559 from mc-hamster/master
Endpoint to restart device, new sequence to force device into softAP, network scanner
2020-12-12 22:43:37 -08:00
Jm Casler
86952c5456 Fixed #541 - Work around to bug in espressif softap event handler 2020-12-12 22:37:07 -08:00
Jm Casler
46781357df remove hard coded network 2020-12-12 21:43:01 -08:00
Jm Casler
bb9abf2dca #560 Forgot to switch back to application/json 2020-12-12 21:42:32 -08:00
Jm Casler
5249608dce #561 Add escapes to strings 2020-12-12 21:35:21 -08:00
Kevin Hester
ee8f4de5ab make plugin reply handling simpler 2020-12-13 12:57:37 +08:00
Jm Casler
17297db2b1 #561 - Add a scan for SSID 2020-12-12 20:50:41 -08:00
Kevin Hester
ad8bcba5ef remove hack for the othernet ppr1 rev 1 board 2020-12-13 11:54:00 +08:00
Kevin Hester
138cebbf03 turn nrf52 ble back on 2020-12-13 11:53:32 +08:00
Jm Casler
9f9573d2eb #560 - Add note that we're in admin mode on network screen 2020-12-12 19:18:51 -08:00
Jm Casler
e10b82c118 #560 Partial changes 2020-12-12 19:09:58 -08:00
Jm Casler
d82aaaa806 #560 - Partial work for Charles. 2020-12-12 18:33:52 -08:00
Jm Casler
c0d94ae4ab Update main.cpp 2020-12-12 14:04:52 -08:00
Jm Casler
02ce12607c #560 - Force SoftAP if the user button is held down during startup.
#560 - Force SoftAP if the user button is held down during startup.
2020-12-12 13:54:14 -08:00
Jm Casler
bdeba54c50 Merge pull request #29 from meshtastic/master
Merge pull request #553 from mc-hamster/master
2020-12-12 12:38:49 -08:00
Jm Casler
26c9585c9d #557 - Switch from GET to POST 2020-12-12 12:38:17 -08:00
Jm Casler
696255c1f7 #557 - Endpoint to restart device over http(s) 2020-12-12 12:36:16 -08:00
Jm Casler
d857f8ba6d Merge pull request #553 from mc-hamster/master
Fix for #551 and #552
2020-12-12 11:56:29 -08:00
Jm Casler
5852caa61c Fix bug #551 - Turn the led off before shutting down.
Fix bug #551 - Turn the led off before shutting down.
2020-12-11 23:03:32 -08:00
Jm Casler
e82752c777 #552 - Updated the 404 handler for / to refer to instructions for how to fix the problem.
#552 - Updated the 404 handler for / to refer to instructions for how to fix the problem.
2020-12-11 22:54:48 -08:00
Jm Casler
3eae2c6286 Merge pull request #28 from meshtastic/master
update my repo from master
2020-12-11 22:42:31 -08:00
Kevin Hester
1e5d0b25ad Add doc note about threading and use OSThread to make GPIO watching work
Thanks to @mc-hamster for the idea
2020-12-11 18:29:32 +08:00
Kevin Hester
c8423400ea Merge pull request #548 from geeksville/dev
Dev
2020-12-11 10:11:48 +08:00
Kevin Hester
af88a34f75 update dev docs 2020-12-11 10:03:46 +08:00
Kevin Hester
b9f1ce70cb begin plugin-api tutorial 2020-12-11 09:11:53 +08:00
Kevin Hester
c361c1fab7 Update to nanopb 0.4.4 2020-12-11 08:31:41 +08:00
Kevin Hester
091e953ed4 todo updates 2020-12-10 14:34:50 +08:00
Kevin Hester
9ab02119f5 Merge branch 'udp' into dev 2020-12-10 14:05:13 +08:00
Kevin Hester
2d4849e0d0 remote try catch in new build tool - file was missing 2020-12-10 14:04:19 +08:00
Kevin Hester
16f897d27c Merge pull request #547 from geeksville/udp
1.1.20
2020-12-10 13:32:59 +08:00
Kevin Hester
4cbf0a0730 oops - forgot to check in the new version file, broke CI 2020-12-10 13:19:00 +08:00
Kevin Hester
99c8df8e7d try to fix CI again 2020-12-10 13:17:43 +08:00
Kevin Hester
8e2e4f7e6a Merge remote-tracking branch 'root/master' into udp 2020-12-10 12:46:51 +08:00
Kevin Hester
45d72bd51b fix CI build - make projectdir relative 2020-12-10 12:44:35 +08:00
Jm Casler
781ed3eafd Merge pull request #544 from IZ1IVA/patch-1
Update radio-settings.md
2020-12-09 20:39:18 -08:00
Jm Casler
c66a0a37d8 Merge branch 'master' into patch-1 2020-12-09 20:25:17 -08:00
Jm Casler
92f2007207 Merge pull request #545 from IZ1IVA/patch-2
Update radio-settings.md
2020-12-09 20:24:32 -08:00
Kevin Hester
1f7b537d2d Merge remote-tracking branch 'root/master' into udp 2020-12-10 11:46:03 +08:00
Kevin Hester
cabeacfa94 1.1.21 2020-12-10 11:45:22 +08:00
Kevin Hester
df8b3ebbc7 always pull min_app_version from appload 2020-12-10 11:32:51 +08:00
Kevin Hester
b1c30f0650 Use a custom platformio py file to always set build version 2020-12-10 11:28:15 +08:00
IZ1IVA
194028f9fc Update radio-settings.md
- added ERP reference to LoRaWAN for NA
2020-12-09 11:16:31 +01:00
IZ1IVA
f49c8f4c43 Update radio-settings.md
- corrected dBM into dBm
- specified ERP reference
- added link to ERP in-depth article
2020-12-09 11:04:07 +01:00
Kevin Hester
b3b4c2c1c3 Merge pull request #543 from geeksville/udp
big set of changes from my weeks away
2020-12-08 22:46:26 -08:00
Kevin Hester
a0076eb394 better position debug output 2020-12-09 13:42:36 +08:00
Kevin Hester
a6a4fec4b9 Merge remote-tracking branch 'root/master' into udp 2020-12-09 12:15:32 +08:00
Kevin Hester
2d4657c8d4 Merge pull request #542 from IZ1IVA/patch-1
Update README.md
2020-12-08 20:14:43 -08:00
Kevin Hester
32b8e4f20a fix #536 allow fixed positions
meshtastic --setlat 32.7767 --setlon -96.7970 --setalt 1337
2020-12-09 12:05:15 +08:00
Kevin Hester
3753fef298 add debug_log_enabled 2020-12-09 11:56:41 +08:00
Kevin Hester
a4bb1937c1 Merge remote-tracking branch 'root/master' into udp 2020-12-09 11:21:59 +08:00
Kevin Hester
4bd22dd5db ignore our own msgs for gpio ctrl 2020-12-08 08:16:58 +08:00
Kevin Hester
79a24c200e use autogened protobuf init code 2020-12-07 10:27:31 +08:00
Kevin Hester
90060e84c0 WIP on GPIO example 2020-12-07 10:18:11 +08:00
Kevin Hester
8f5a1f19d3 add remote gpio control as an example plugin
https://github.com/meshtastic/Meshtastic-device/issues/182
2020-12-06 18:33:42 +08:00
Kevin Hester
3e0dc44210 move want_replies into new plugin system 2020-12-05 11:15:06 +08:00
Kevin Hester
91b99bd584 require apps to be 1.1.20 or later 2020-12-05 10:27:04 +08:00
Kevin Hester
b6e21bcbcd add SinglePortPlugin to simpilify api 2020-12-05 10:14:15 +08:00
Kevin Hester
ae7d3ee5ed move nodeinfo messages into new plugin system 2020-12-05 10:00:46 +08:00
Kevin Hester
f1179bd3ea positions now sent using the new API 2020-12-05 08:46:19 +08:00
Kevin Hester
9b24cc6dd6 update protobufs 2020-12-04 18:54:00 +08:00
IZ1IVA
20c5b98b2d Update README.md
Added "Related Groups" section
Added Meshtastic Italian Telegram group link
2020-12-03 12:27:44 +01:00
Kevin Hester
d3cb9bdd4a WIP moving positions to new system 2020-12-03 16:48:44 +08:00
Jm Casler
a70cda6fe4 Merge pull request #27 from meshtastic/master
updated by fork from master
2020-11-29 12:40:32 -08:00
Kevin Hester
7737123d0f begin moving position stuff into plugin 2020-11-28 18:10:31 +08:00
Kevin Hester
5138aff4b2 fix static initializer bug with mesh plugins 2020-11-28 13:25:03 +08:00
Kevin Hester
0b0d293a66 Move text message handling into the new plugin system 2020-11-28 12:10:19 +08:00
Kevin Hester
ddab4a0235 remove support for 8bit nodenums 2020-11-28 09:56:21 +08:00
Jm Casler
50615540ce Merge pull request #538 from meshtastic/dev-https
Merging in dev-https to master
2020-11-27 17:21:56 -08:00
Kevin Hester
f5e42b2533 update protos 2020-11-28 09:17:20 +08:00
Kevin Hester
9e9913101f Merge pull request #527 from geeksville/spiffs-bug496
Spiffs bug496
2020-11-27 17:11:34 -08:00
Kevin Hester
b1289b632a Merge remote-tracking branch 'root/master' into dev 2020-11-28 09:00:21 +08:00
Kevin Hester
c427c8abf9 oops - fix my crummy merge 2020-11-28 08:55:56 +08:00
Jm Casler
9170dc7738 Merge pull request #534 from mc-hamster/master
Fix for #533 - We will deinit wifi even if it were never initialized.
2020-11-27 16:19:03 -08:00
Kevin Hester
cc36e3a9a6 Merge branch 'dev-https' into spiffs-bug496 2020-11-27 16:15:14 -08:00
Jm Casler
7d4c77abfd Fix for #533 - deinitWifi() will de initialize the radio even if it was never initialized 2020-11-27 14:49:44 -08:00
Jm Casler
1ba91ec27f Merge pull request #26 from meshtastic/master
update my repo from master
2020-11-25 21:36:56 -08:00
Jm Casler
575c5b2193 Merge pull request #532 from meshtastic/mc-hamster-patch-2
wait_bluetooth_secs to 60 seconds.
2020-11-22 19:38:39 -08:00
Jm Casler
3473a1e323 wait_bluetooth_secs to 60 seconds. 2020-11-22 19:32:48 -08:00
Jm Casler
11a00e2977 Merge pull request #531 from mc-hamster/master
Add support for the power button #528
2020-11-22 19:19:35 -08:00
Jm Casler
817c99e09c trying to fix it again 2020-11-22 19:12:11 -08:00
Jm Casler
9801a62d2d Fix for CI on other boards. 2020-11-22 19:01:48 -08:00
Jm Casler
2bd40b7053 Add support for the power button #528 2020-11-22 18:50:14 -08:00
Jm Casler
dccc15946b Merge pull request #530 from mc-hamster/master
Removing stuff I accidently checked in for the duplexer
2020-11-22 16:50:45 -08:00
Jm Casler
3ab9d2a50e Removing stuff I accidently checked in for the duplexer 2020-11-22 16:24:22 -08:00
Jm Casler
776a978ea0 Merge pull request #529 from mc-hamster/master
Accidentally checked in my rf deduplixer
2020-11-22 15:44:19 -08:00
Jm Casler
f60922af34 Accidently checked in my rf deduplexer 2020-11-22 15:42:36 -08:00
Kevin Hester
cb34fd5eb9 Merge remote-tracking branch 'root/master' into dev 2020-11-20 08:59:54 +08:00
Kevin Hester
19d81347f2 1.1.9 (release for @mc-hamster only in android app alpha) 2020-11-20 07:42:02 +08:00
Kevin Hester
d7d13d637c clean up filesystem goo, add spiffs to install scripts, fix #496
@mc-hamster seems to work pretty good for me, so I'll send a PR to you
for the dev-http branch.

I'll push out an android alpha build later today (once the build is
complete).  Once this new device load is out in the field _future_
device builds will support updating spiffs from android. (i.e. device
loads older than 1.1.9 must be updated to 1.1.9 or later before spiffs
support is implemented on the device side - so some users might need to
update twice before the new spiffs contents will appear on their device)
2020-11-19 09:25:02 +08:00
Kevin Hester
df75cefeeb fix #525 - turn off (buggy) TinyGPS custom candidates support 2020-11-18 10:54:25 +08:00
Jm Casler
66f9dbec45 Merge pull request #524 from meshtastic/mc-hamster-patch-1
Lora Design Guide
2020-11-17 13:16:49 -08:00
Jm Casler
4679dd7c4d Lora Design Guide
Airtime calculation is in section 4.
2020-11-17 11:14:57 -08:00
Jm Casler
a02979d564 Merge branch 'externalAmp' into master 2020-11-16 19:54:06 -08:00
Kevin Hester
f2698bbf91 bug #496 - allow update clients to program SPIFFS region
also have build system properly build spiffs release builds
2020-11-16 08:56:32 +08:00
Kevin Hester
d045139945 return ble errors for invalid values 2020-11-16 07:57:32 +08:00
Kevin Hester
2c9c5991a0 add a script for testing release builds 2020-11-15 08:24:34 +08:00
Jm Casler
1b365fa0aa Merge pull request #24 from meshtastic/dev-https
Dev https
2020-11-13 21:40:00 -08:00
Jm Casler
71d1d4d8fa Merge pull request #521 from meshtastic/master
Update dev-https from master
2020-11-13 21:35:20 -08:00
Jm Casler
64df994a32 Merge pull request #520 from crossan007/dev-https
Only issue ContentType header once; correctly.
2020-11-13 20:13:31 -08:00
Charles Crossan
49a19e26d5 Only issue ContentType header once; correctly. 2020-11-13 22:07:52 -05:00
Kevin Hester
ef37f955c3 Merge remote-tracking branch 'root/master' into dev 2020-11-14 10:22:10 +08:00
Kevin Hester
ac50b9544b Merge pull request #519 from geeksville/bug513
Bug513
2020-11-14 10:21:44 +08:00
Kevin Hester
ccc1600bc9 remove stale fixme 2020-11-14 10:19:55 +08:00
Kevin Hester
7c220f8a39 Merge branch 'master' into bug513 2020-11-14 10:14:22 +08:00
Kevin Hester
1839f8f7ca fix #513 scale retransmission times based on true packet time on wire 2020-11-14 10:07:25 +08:00
Kevin Hester
48c461c50c Merge pull request #515 from geeksville/eink
nrf52 deep sleep support
2020-11-13 11:08:17 +08:00
Kevin Hester
f346b4f0f2 Merge branch 'eink' into bug513 2020-11-13 09:41:23 +08:00
Kevin Hester
5aab4f5c95 Merge branch 'master' into eink 2020-11-13 09:36:18 +08:00
Kevin Hester
d407db5ee1 add more deep sleep support for nrf52 boards 2020-11-13 09:33:59 +08:00
Kevin Hester
93afc71e2e Show "sleeping" on eink while in deep sleep 2020-11-13 07:49:01 +08:00
Kevin Hester
67e657f10f always print debug output to both serial and segger debug port
cc @mc-hamster, this  makes USE_SEGGER optional on nrf52 targets
2020-11-13 07:48:25 +08:00
Kevin Hester
619a48085a pinetab docs 2020-11-12 18:31:35 +08:00
Kevin Hester
68937d52fe bug #503 wip 2020-11-12 17:49:04 +08:00
Jm Casler
e33657eb75 Toggle GPIO2 to HIGH when transmitting a packet out the LORA radio. 2020-11-09 19:47:31 -08:00
Kevin Hester
21751da5a2 Merge pull request #512 from geeksville/dev
Dev
2020-11-07 04:19:36 -08:00
Kevin Hester
c2e8ac7173 1.1.8 2020-11-07 19:20:38 +08:00
Jm Casler
825001f313 Merge pull request #23 from mc-hamster/master
update
2020-11-06 23:12:50 -08:00
Jm Casler
576526576a Merge pull request #511 from mc-hamster/master
Web text editor #510
2020-11-06 23:11:09 -08:00
Kevin Hester
2fd5ce00ce fix build for esp32 targets 2020-11-07 15:09:05 +08:00
Jm Casler
4204c494ae fix poorly merged file 2020-11-06 22:41:26 -08:00
Jm Casler
84beae1001 Merge branch 'dev-https' into master 2020-11-06 22:29:03 -08:00
Jm Casler
951b4293c4 Set web cookie and web text editor. 2020-11-06 22:21:20 -08:00
Kevin Hester
952c216bf7 Merge remote-tracking branch 'root/master' into dev 2020-11-07 14:08:22 +08:00
Kevin Hester
ff4b03b8c1 Fix #509 was causing failure on non GPS equipped boards 2020-11-07 09:15:28 +08:00
Kevin Hester
c5903a790b update for portduino 2020-10-31 15:50:39 +08:00
Kevin Hester
bbc36f7b6f switch to my new SD 7.2.0 S113 based bootloader 2020-10-31 12:22:20 +08:00
Jm Casler
2f9ef463d8 Merge pull request #507 from meshtastic/master
update dev-https from master
2020-10-30 21:04:16 -07:00
Jm Casler
bea00569fd Merge pull request #22 from meshtastic/master
update my fork from master
2020-10-30 21:03:40 -07:00
Kevin Hester
d7368d5a51 begin deep sleep support for nrf52 2020-10-30 17:05:32 +08:00
Kevin Hester
47bbde3c60 fix #505 allow forced standby mode to not assert fail 2020-10-29 16:13:44 +08:00
Kevin Hester
04942a3570 fix #505 - device can reboot due to race condition in sending 2020-10-29 15:27:05 +08:00
Kevin Hester
62a8c968e8 Merge pull request #504 from geeksville/dev
Dev
2020-10-28 23:14:52 -07:00
Kevin Hester
b9a1cae72d 1.1.7 2020-10-29 13:27:52 +08:00
Kevin Hester
6b442784f3 Merge remote-tracking branch 'root/master' into dev 2020-10-29 13:26:49 +08:00
Kevin Hester
cfcb62bd18 Make region changes take effect immedately 2020-10-29 13:26:36 +08:00
Kevin Hester
f698883c02 add pinetab docs 2020-10-29 13:26:14 +08:00
Kevin Hester
4a5cef886e Merge pull request #450 from BeardyWalrus/master
Fix for #357 - Bluetooth pairing pin disable on devices with no display
2020-10-28 18:44:58 -07:00
Kevin Hester
f6ec129288 Merge branch 'master' into master 2020-10-28 18:38:27 -07:00
Kevin Hester
17763034a0 Merge pull request #503 from geeksville/ppr1
Ppr1
2020-10-27 22:26:18 -07:00
Kevin Hester
4ad562b9f4 The new 7.2.0 soft device works on nrf52833 2020-10-28 13:01:50 +08:00
Kevin Hester
6b838002d4 switch back to tbeam for merge to master 2020-10-28 09:51:30 +08:00
Kevin Hester
5e0d53a1e3 ppr1 todo updates 2020-10-28 09:48:28 +08:00
Jm Casler
b1dae3608e Merge pull request #502 from mc-hamster/master
Update to basic.js and add mime types.
2020-10-26 18:18:16 -07:00
Jm Casler
44aafd5b9c Update to basic.js and add mime types. 2020-10-26 18:17:33 -07:00
Kevin Hester
7597d5b3fd PPR1 - GPS serial now works 2020-10-25 17:07:54 +08:00
Kevin Hester
1a8891c33d ppr1: add crude version of charge controller driver 2020-10-24 18:40:47 +08:00
Kevin Hester
f0eeaf01d4 ppr1 lcd is 'good enough' for now 2020-10-24 09:49:14 +08:00
Kevin Hester
d4e95e95a6 fix long-press handling on alternate button 2020-10-24 08:44:54 +08:00
Kevin Hester
0767c8be03 PPR1 fix screen mirroring on LCD 2020-10-24 08:16:15 +08:00
Kevin Hester
18bbf3523e remove unused display code 2020-10-23 22:18:22 +08:00
Kevin Hester
b081a6da56 ppr1 st7567 lcd kinda works now 2020-10-23 18:00:43 +08:00
Kevin Hester
a102e49fdb PPR1 WIP - hacky code to make LCD talk on I2C. Works! 2020-10-23 17:10:48 +08:00
Kevin Hester
c078c08c3e Merge branch 'dev' into ppr1 2020-10-23 16:53:38 +08:00
Jm Casler
91756d1fec Merge pull request #501 from mc-hamster/master
Fixed typo. Updated js library. Update root file handler.
2020-10-22 18:46:26 -07:00
Jm Casler
5981831bc0 Fixed typo. Updated js library. Update root file handler.
Typo fixed. I placed the latest javascript library files into the static folder. Updated the root file handler to be able to serve both compressed and uncompressed files.
2020-10-22 18:43:54 -07:00
Jm Casler
00eed206cb Update typo, import from js library 2020-10-22 18:26:43 -07:00
Jm Casler
130d55aaaa Merge pull request #500 from mc-hamster/master
Updated dev-https from my fork.
2020-10-21 21:29:34 -07:00
Jm Casler
13ef48094d Merge pull request #21 from meshtastic/dev-https
Dev https to my fork
2020-10-21 21:20:55 -07:00
Jm Casler
529fd5a830 Merge pull request #499 from meshtastic/master
Update dev-https from master
2020-10-21 21:20:07 -07:00
Jm Casler
baa3d1dae4 Support for the SPIFFS 2020-10-21 20:57:44 -07:00
Kevin Hester
4dd50df810 Merge pull request #498 from geeksville/dev
1.1.6
2020-10-21 04:28:55 -07:00
Kevin Hester
14c4022c18 1.1.6 (and screen layout tweaks) 2020-10-21 19:18:03 +08:00
Kevin Hester
a5d7bacdbf Show current region on the boot screen 2020-10-21 17:27:13 +08:00
Kevin Hester
0b3c25f6d9 use correct code for "talking to phone" fixes OTA update while a router 2020-10-21 16:50:09 +08:00
Kevin Hester
ad7a474a52 update buildscript to generate universal/regionless roms 2020-10-21 12:48:04 +08:00
Kevin Hester
430186ec53 Merge remote-tracking branch 'root/master' into dev 2020-10-21 10:44:56 +08:00
Jm Casler
e9279919ae Remove uncompressed style.css. Combine SSID/PWD on same line and toggle between the two every 10 seconds. 2020-10-19 16:58:11 -07:00
Jm Casler
227c6fc27e Merge pull request #494 from meshtastic/dev-https
Added the x-protobuf-schema, initial integration of javascript library, tuning of the CPU throttle timer.
2020-10-18 22:03:46 -07:00
Jm Casler
a37844d7e5 Merge pull request #493 from mc-hamster/master
update case of meshhttpStatic.h
2020-10-18 21:55:25 -07:00
Jm Casler
ff20b29c3c update case of meshhttpStatic.h 2020-10-18 21:44:55 -07:00
Jm Casler
64c29c4a35 Merge pull request #490 from mc-hamster/master
Update filename, cpu clock timer, add more debug info on the web server startup
2020-10-18 21:41:34 -07:00
Jm Casler
d4df3f8a7e mDNS server http://meshtastic.local 2020-10-18 21:39:02 -07:00
Jm Casler
a16c3af30a Clarified debug message regardding the Web Server startup status. 2020-10-18 18:44:08 -07:00
Jm Casler
3061860dab Update sleep timer for the CPU clock 2020-10-18 18:30:19 -07:00
Jm Casler
2450d98b59 Merge branch 'master' of https://github.com/mc-hamster/Meshtastic-device 2020-10-18 18:08:03 -07:00
Jm Casler
a371592ad9 Added instructions for David 2020-10-18 18:07:44 -07:00
Jm Casler
f7aaf48ae9 Merge pull request #20 from meshtastic/dev-https
Update my branch from dev-https
2020-10-18 18:04:49 -07:00
Jm Casler
1fb604ebc8 Merge pull request #488 from mc-hamster/master
Update dev-https from my fork.
2020-10-18 16:44:01 -07:00
Jm Casler
df2733a3b5 readded nodeScriptScriptsJS. it got lost in the transition to the new webserver 2020-10-17 20:28:19 -07:00
Kevin Hester
8fd3cb1aac add crude charging detection for 'dumb' voltage based battery sensors 2020-10-18 09:44:29 +08:00
Kevin Hester
485c476f17 cleaner battery debug messages 2020-10-18 09:32:12 +08:00
Jm Casler
7dd4ce32d2 Moved style.css into meshhttpStatic.h
Also created /data to store static files before they go into meshhttpStatic.h
2020-10-17 17:33:29 -07:00
Jm Casler
7f12af73d4 Updated to be host and protocol agnostic 2020-10-17 12:00:21 -07:00
Jm Casler
63113d57b3 Initial integration of meshtastic.js and sample code 2020-10-17 11:30:59 -07:00
Jm Casler
32850ff39d Merge pull request #487 from mc-hamster/master
Some cleanup and implement the X-Protobuf-Schema header
2020-10-16 23:40:48 -07:00
Jm Casler
2901f773a4 Some cleanup and implement the X-Protobuf-Schema header 2020-10-16 23:33:50 -07:00
Kevin Hester
a7c54e4ad7 Merge remote-tracking branch 'root/master' into dev 2020-10-17 13:41:51 +08:00
Kevin Hester
e1f0e11cb8 ppr1 WIP DO NOT MERGE - will break other clients 2020-10-17 13:15:12 +08:00
Kevin Hester
c73ee98739 Merge branch 'master' into ppr1 2020-10-17 11:00:28 +08:00
Jm Casler
c2a1141dfa Merge pull request #485 from mc-hamster/master
update class case of HttpAPI
2020-10-16 19:40:32 -07:00
Jm Casler
5b4472ab56 fix case of HttpAPI class 2020-10-16 19:38:59 -07:00
Jm Casler
3262f732d8 Merge pull request #19 from meshtastic/master
update my branch from master
2020-10-16 19:31:59 -07:00
Jm Casler
cff21ca130 Merge pull request #484 from meshtastic/dev-https
Functional protobuf/rest interface.
2020-10-16 19:28:40 -07:00
Jm Casler
81ce04d3da Merge branch 'master' into dev-https 2020-10-16 19:21:06 -07:00
Jm Casler
f4d2b10840 Merge pull request #483 from mc-hamster/master
Update for interface with the JS client.
2020-10-16 19:18:31 -07:00
Jm Casler
2370cb8aac Merge pull request #482 from meshtastic/dev-https
Merge from dev-https to master.
2020-10-16 19:10:04 -07:00
Kevin Hester
59ec87f5b0 oops tbeam was inheriting from arduino, it should inherit from esp32 2020-10-17 09:58:34 +08:00
Jm Casler
0d9481b6ea add allow-headers 2020-10-16 18:00:28 -07:00
Jm Casler
8f0105ccd9 don't send content-type when options is set 2020-10-16 17:46:22 -07:00
Kevin Hester
05ca3c3d56 Update to work with my font size change 2020-10-17 08:44:04 +08:00
Jm Casler
ba549d8fcd Return OPTIONS when requested for toradio 2020-10-16 17:41:08 -07:00
Jm Casler
b9df2c00fa fromradio all option
requesting fromradio will return one protobuf
4:56
requesting fromradio?all=true will give you all of them.
2020-10-16 17:07:35 -07:00
Kevin Hester
d9dcb33576 Merge branch 'master' into dev-https 2020-10-16 17:05:06 -07:00
Jm Casler
f698231be7 Merge branch 'master' of https://github.com/mc-hamster/Meshtastic-device 2020-10-16 16:36:55 -07:00
Jm Casler
8414f4a6a3 Added access-control-allow headers 2020-10-16 16:36:52 -07:00
Kevin Hester
8505020be5 Merge branch 'dev' into ppr1 2020-10-16 17:03:30 +08:00
Kevin Hester
f3b93d55fb oops fix for esp32 2020-10-16 17:03:04 +08:00
Kevin Hester
9e0731a956 Merge branch 'dev' into ppr1 2020-10-16 17:01:42 +08:00
Kevin Hester
2b373048c6 fix battery voltage sensing on NRF52 boards 2020-10-16 17:00:27 +08:00
Kevin Hester
22f23bb07d Merge branch 'dev' into ppr1
# Conflicts:
#	src/gps/NMEAGPS.cpp
2020-10-16 15:59:55 +08:00
Kevin Hester
b32e3f1269 Merge pull request #479 from geeksville/dev
minor eink things
2020-10-15 23:44:15 -07:00
Kevin Hester
68ddb712f5 properly keep nrf52s from sleeping 2020-10-16 14:00:56 +08:00
Kevin Hester
2fb5cd8c1c work with more NMEA gps sentences 2020-10-16 14:00:17 +08:00
Kevin Hester
79aea8231f make screen positions less hardwired wrt font size 2020-10-16 11:22:07 +08:00
Kevin Hester
b0837c10c6 eink display improvements 2020-10-16 10:53:55 +08:00
Jm Casler
cd811951b1 Merge pull request #481 from mc-hamster/master
Update from mchamster to dev-https
2020-10-15 19:53:03 -07:00
Jm Casler
df2976dad0 Merge pull request #18 from meshtastic/dev-https
From Dev https to mc-hamster master
2020-10-15 19:40:49 -07:00
Jm Casler
4ccbe6ff71 Merge pull request #480 from meshtastic/master
Updating dev-https from master
2020-10-15 19:40:01 -07:00
Jm Casler
038ddb887f Be a little smarter with setting the CPU frequency
in the event we have HTTPS and HTTP requests within close periods, let the speed set by the HTTPS request take presidence.
2020-10-15 19:28:20 -07:00
Kevin Hester
9134faaed1 turn off segger debug in ttgo eink build 2020-10-15 16:11:40 +08:00
Kevin Hester
649a120fe0 make eink screen look nicer 2020-10-15 15:56:38 +08:00
Kevin Hester
4db0c4a563 Make screen code resolution agnostic. Look better on big TFT/eink screens 2020-10-15 15:12:27 +08:00
Kevin Hester
5f2f3c94b9 PPR1 and allow boards to set lower or higher sx1262 power limits 2020-10-15 13:47:10 +08:00
Jm Casler
3b2f5fa5e3 fromRadio now returns all the vailable protobufs. a request to http sets the cpu clock to 160mhz, https to 240mhz then will clock it back down after 2 minutes. 2020-10-14 20:24:19 -07:00
Jm Casler
97adb598b6 toRadio is functional 2020-10-14 16:17:12 -07:00
Kevin Hester
152ebf0dff Merge branch 'dev' into ppr1 2020-10-14 10:24:39 +08:00
Kevin Hester
5b1511c930 ppr1 make jlink scripts 2020-10-14 10:21:55 +08:00
Kevin Hester
7ef2cc8623 Merge pull request #478 from geeksville/dev
1.1.5
2020-10-13 18:11:15 -07:00
Kevin Hester
b41a32c6b6 1.1.5 2020-10-14 09:04:20 +08:00
Kevin Hester
1ebd7b0c3e make lightsleep default time 5 minutes, with 1 minute in for BLE syncing 2020-10-14 08:53:12 +08:00
Kevin Hester
5457541244 fix #477: sleep behavior was broken in app due to device bug since 1.1.1
+        // NOTE: The phone app needs to know the ls_secs value so it can properly expect sleep behavior.
+        // So even if we internally use 0 to represent 'use default' we still need to send the value we are
+        // using to the app (so that even old phone apps work with new device loads).
2020-10-14 08:45:29 +08:00
Kevin Hester
ca77d48b20 corvus2 gps still doesn't work WIP 2020-10-13 14:43:28 +08:00
Kevin Hester
965c2bda8d corvus2 board builds 2020-10-13 13:59:06 +08:00
Jm Casler
02e3438d5e Added a favicon.ico 2020-10-11 22:13:14 -07:00
Jm Casler
02b1ece6ac Update meshhttp.cpp 2020-10-11 21:30:14 -07:00
Jm Casler
9fdef366f7 Merge pull request #473 from mc-hamster/master
update dev-https from my fork
2020-10-11 21:20:50 -07:00
Jm Casler
284816229e Merge pull request #17 from meshtastic/master
update my fork from head
2020-10-11 21:19:39 -07:00
Jm Casler
10008d4eef fix merge conflict 2020-10-11 21:19:22 -07:00
Jm Casler
58cfd1317c Merge branch 'master' of https://github.com/mc-hamster/Meshtastic-device 2020-10-11 20:38:13 -07:00
Jm Casler
3d3f7869d4 Increase CPU frequency on HTTPS requests. Clock back down after a period of time. 2020-10-11 20:38:09 -07:00
Kevin Hester
ef325289eb fix a doc error 2020-10-12 11:09:53 +08:00
Kevin Hester
40c63c0615 Merge pull request #472 from geeksville/dev
1.1.4
2020-10-11 18:39:02 -07:00
Kevin Hester
a9de8b9bb3 oops - only read axp on boards that have it 2020-10-12 09:33:15 +08:00
Kevin Hester
66a7f896c8 1.1.4 2020-10-12 09:27:48 +08:00
Kevin Hester
45a36f5571 fix POWER state entry/exit based on loss of USB power (tx @mc-hamster) 2020-10-12 09:27:07 +08:00
Jm Casler
876d32c9ee Merge pull request #16 from geeksville/mc-master
fix build for linux (by moving esp32 specific lib to esp32 tree)
2020-10-11 18:17:20 -07:00
Kevin Hester
b9ce75b09c fix build for linux (by moving esp32 specific lib to esp32 tree) 2020-10-12 09:03:04 +08:00
Kevin Hester
62493efc40 Merge pull request #471 from geeksville/coroutine
fix my breakage
2020-10-11 17:42:26 -07:00
Kevin Hester
2848b76cc9 Merge branch 'master' into coroutine 2020-10-11 17:28:52 -07:00
Kevin Hester
ef8bea478d Merge branch 'coroutine' of https://github.com/geeksville/Meshtastic-esp32 into coroutine 2020-10-12 08:25:33 +08:00
Kevin Hester
a8e4bbbe65 fix my breaking of button press behavior 2020-10-12 08:25:17 +08:00
Kevin Hester
9a414d9c77 fix my breakage of screen waking 2020-10-12 08:13:32 +08:00
Jm Casler
48e6a60a07 Merge pull request #470 from mc-hamster/master
Merge pull request #15 from meshtastic/master
2020-10-10 22:30:34 -07:00
Jm Casler
ca48079545 Merge pull request #15 from meshtastic/master
updated my branch from head
2020-10-10 22:29:09 -07:00
Jm Casler
76b4be3b87 Merge pull request #469 from mc-hamster/master
Switched to esp32_https_server from the Espressif (Issue #452) and Enable RX LNA (#466)
2020-10-10 22:28:08 -07:00
Jm Casler
d39cc3d57b Checking if ESP32 for the frequency display 2020-10-10 22:06:56 -07:00
Jm Casler
b17a8d7a6a Removed powerExit -- it wasn't working 2020-10-10 21:54:27 -07:00
Kevin Hester
3d21794039 Merge pull request #465 from geeksville/coroutine
Lightweight thread refactoring
2020-10-10 18:32:15 -07:00
Kevin Hester
beac614e65 Merge branch 'master' into coroutine 2020-10-10 18:19:40 -07:00
Kevin Hester
87f2673fc4 Merge pull request #463 from geeksville/dev
fix #462 publish immediately on any GPS state change
2020-10-10 18:19:22 -07:00
Kevin Hester
999b292717 fixes for the posix port 2020-10-11 09:18:47 +08:00
Jm Casler
c16acb904e Merge branch 'master' of https://github.com/mc-hamster/Meshtastic-device 2020-10-10 17:59:46 -07:00
Jm Casler
5b777219be Enable the RX LNA #466
Enabling the RX LNA
2020-10-10 17:59:32 -07:00
Jm Casler
32ea11d2af Merge pull request #14 from meshtastic/master
Update from head
2020-10-10 17:23:13 -07:00
Kevin Hester
8330c3270e 1.1.3 2020-10-11 08:15:52 +08:00
Kevin Hester
0c8e0efed2 new threading finished- saves about 10mA for the high activity states 2020-10-11 08:12:53 +08:00
Kevin Hester
c44d8a0433 Merge remote-tracking branch 'root/master' into coroutine 2020-10-10 18:12:37 +08:00
Kevin Hester
49b4ed2a89 coroutine: kinda works now 2020-10-10 18:03:45 +08:00
Jm Casler
db8faa9faf added powerExit 2020-10-09 23:07:37 -07:00
Kevin Hester
4b9ea4f808 Merge branch 'dev' into coroutine 2020-10-10 09:22:23 +08:00
Kevin Hester
c3beca3e23 Merge branch 'master' into dev 2020-10-09 18:21:16 -07:00
Kevin Hester
95cb6b06e4 fix #462 publish immediately on any GPS state change
(don't wait until end of aquisition window)
2020-10-10 09:20:38 +08:00
Kevin Hester
c46a884558 concurrency wip 2020-10-10 08:28:00 +08:00
Kevin Hester
2044427e97 coroutines: wip compiles but does not link 2020-10-09 14:16:51 +08:00
Kevin Hester
514ebdf013 Merge pull request #460 from geeksville/dev
Dev
2020-10-08 19:09:12 -07:00
Kevin Hester
10f64590a9 Merge branch 'dev' into coroutine 2020-10-09 10:03:27 +08:00
Kevin Hester
4a70ba1f7a fix nodeinfo stored times (I think) for @lgoix 2020-10-09 10:01:13 +08:00
Kevin Hester
dd6a402ea0 coroutine: wip 2020-10-09 09:10:44 +08:00
Kevin Hester
bed7d8a619 threads: begin change to cooperative threading 2020-10-08 13:32:34 +08:00
Jm Casler
6d178ebc91 Added esp32_https_server to the meshtastic project 2020-10-07 22:18:46 -07:00
Jm Casler
f75a256631 Merge branch 'master' of https://github.com/mc-hamster/Meshtastic-device 2020-10-07 22:02:59 -07:00
Jm Casler
4f659b7563 Initial check in of HTTPS server for #452
This switches from the espressif web server to esp32_https_server. Both HTTPS and HTTP have been migrated. On board SSL key generation.
2020-10-07 22:02:53 -07:00
Kevin Hester
1b6e8e36d3 Merge remote-tracking branch 'root/master' 2020-10-08 11:14:28 +08:00
Kevin Hester
7a4b8cde11 keep rf95 max power at 20 dBm so users don't smoke their boards 2020-10-08 10:51:31 +08:00
Kevin Hester
113859e791 increase sx1272 max power
+#define MAX_POWER 27
 // if we use 20 we are limited to 1% duty cycle or hw might overheat.  For continuous operation set a limit of 17
+// In theory up to 27 dBm is possible, but the modules installed in most radios can cope with a max of 20.  So BIG WARNING
+// if you set power to something higher than 17 or 20 you might fry your board.
2020-10-08 09:57:59 +08:00
Kevin Hester
a6b82ccfd9 Merge pull request #457 from geeksville/master
fixes based on alpha tester report
2020-10-07 16:55:41 -07:00
Kevin Hester
e8b8ec69f1 1.1.2 2020-10-08 07:48:14 +08:00
Kevin Hester
023f1c24fb RTC: add notion of 'quality' for different time sources
Allow use of mesh based time until a GPS time arrives
2020-10-08 07:46:20 +08:00
Kevin Hester
f00d07baa3 RTC: pull rtc code into own file for cleanup 2020-10-08 07:28:57 +08:00
Kevin Hester
62c228b986 gps: don't stop lock attempts just because the main cpu is sleeping 2020-10-08 06:23:53 +08:00
Kevin Hester
1a3cc40c7e sx1262 better to check for header because preamble might never result in irq 2020-10-08 06:23:05 +08:00
Kevin Hester
bdcd5c3981 allow reporting # sats before we ahve a fix 2020-10-08 06:22:25 +08:00
Kevin Hester
fc82e872d6 don't require gps to have lock before we'll trust GPS time 2020-10-08 05:23:52 +08:00
Jm Casler
dffcea1f4d Merge pull request #13 from meshtastic/master
Update my fork from head with 1.1 changes
2020-10-07 08:32:54 -07:00
Kevin Hester
b47c54b5b6 keep lora radio totally unpowered when in deep-sleep 2020-10-07 17:52:44 +08:00
Kevin Hester
c0c83ad389 If we are not supposed to share locations make sure phone doesn't either 2020-10-07 17:46:25 +08:00
Kevin Hester
23aecbdc38 Merge pull request #456 from geeksville/power
major cleanup of GPS code and changes to keep GPS asleep
2020-10-06 23:26:39 -07:00
Kevin Hester
eca7242a1f fix NRF52 build 2020-10-07 14:00:59 +08:00
Kevin Hester
ef899425b8 1.1.1 2020-10-07 13:46:39 +08:00
Kevin Hester
269f90c510 Force GPS power to zero when in deep sleep 2020-10-07 13:44:17 +08:00
Kevin Hester
7a5832ab8a SX1262: fix serious bug with detecting if we have a rx packet in progress
Could cause hangs on the way into sleep (and enormous power consumption).
Instead of checking for rx packet length (which only changes at completion)
check if we've received preamble bits but haven't yet received a completed
packet interrupt.

notes:


wait to sleep loop problem
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
Can not send yet, busyRx
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0

vs normal run
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
radio wait to sleep, txEmpty=0
Starting low level send (id=0x53fe1dd0 Fr0xe5 To0xff, WantAck0, HopLim3 encrypted)
Completed sending (id=0x53fe1dd0 Fr0xe5 To0xff, WantAck0, HopLim3 encrypted)
2020-10-07 13:43:51 +08:00
Kevin Hester
044cc26340 #376 use power off command instead of killing gps power per manual 9.5 2020-10-07 11:44:30 +08:00
Kevin Hester
4ccd03623f bug #376: disable the "wake on serial" feature, because it causes
bogus wakes on TBEAMS because the USB->SERIAL chip pulls the RX input
to ground.  This feature is no longer needed because in !isRouter
nodes we force the node to never sleep anyways when on USB power.

    // this doesn't work on TBEAMs when the USB is depowered (causes bogus interrupts)
    // So we disable this "wake on serial" feature - because now when a TBEAM (only) has power connected it
    // never tries to go to sleep if the user is using the API
    // gpio_wakeup_enable((gpio_num_t)SERIAL0_RX_GPIO, GPIO_INTR_LOW_LEVEL);
2020-10-06 14:24:08 +08:00
Kevin Hester
7854a22fbf bug #376 - stop using pmu IRQ - we don't need it and it causes LS wakes 2020-10-06 12:45:19 +08:00
Kevin Hester
943d5cb08d bug #376 we were not staying in light sleep as long as intended 2020-10-06 11:48:53 +08:00
Kevin Hester
7480eb1826 Change to use zeros for timeout values that are 'default' 2020-10-06 09:43:00 +08:00
Kevin Hester
c32c97c389 TBEAM 1.1 has an extra controllable LED - blink that also 2020-10-06 08:20:06 +08:00
BeardyWalrus
b4b1b24c84 always need double press, even if you dont have a screen 2020-10-05 20:13:04 -04:00
Kevin Hester
ef146fc0b5 bug #376 - wip time only mode now works 2020-10-06 06:27:46 +08:00
Kevin Hester
f6861a8fe2 bug #376 wip - we now minimize comms to gps to save power 2020-10-06 06:07:30 +08:00
Kevin Hester
736642455f bug #376 wip - we now respect the new gps_operating_mode pref. 2020-10-06 05:34:56 +08:00
Kevin Hester
3c1c11e439 bug #376 wip - we now kill gps power when it is supposed to be asleep 2020-10-05 15:29:26 +08:00
Kevin Hester
b072eec4ac wip for #376 2020-10-05 14:43:44 +08:00
Kevin Hester
ff9b49ddaa add lora32 schematic
Signed-off-by: Kevin Hester <kevinh@geeksville.com>
2020-10-05 11:03:30 +08:00
Kevin Hester
b8863c8a07 Merge remote-tracking branch 'root/master' into power 2020-10-05 10:56:50 +08:00
BeardyWalrus
4d7cd0a09d conditional on needing ESP32 bluetooth header loaded 2020-10-03 17:23:36 -04:00
BeardyWalrus
fed8e80ae4 Merge branch 'master' into master 2020-10-03 17:04:47 -04:00
BeardyWalrus
b38bcffafb Merge branch 'master' of https://github.com/BeardyWalrus/Meshtastic-device 2020-10-03 17:02:19 -04:00
BeardyWalrus
530432411e revised fix for #357
Now supports default password for devices with no display, and override with double press of user button
2020-10-03 17:02:17 -04:00
Jm Casler
71cdbb1a73 Merge pull request #454 from mc-hamster/master
Update readme to link to the US aliexpress listing
2020-10-01 20:39:38 -07:00
Jm Casler
200aa27cc0 Merge branch 'master' of https://github.com/mc-hamster/Meshtastic-device 2020-10-01 20:08:01 -07:00
Jm Casler
f7752e4f9d Merge pull request #12 from meshtastic/master
Update my repo from head
2020-10-01 20:07:07 -07:00
Jm Casler
7f0e8a8d6b Update readme to link to the US aliexpress listing for T-Beam V1.1 w/ NEO-M8N /w SX1262 2020-10-01 20:04:12 -07:00
BeardyWalrus
f30c84012f Merge branch 'master' into master 2020-10-01 22:24:30 -04:00
Jm Casler
1f6877606f Merge pull request #453 from ikstream/update_readme
Fix update/install instructions
2020-10-01 17:32:55 -07:00
geeksville
1907873831 gps wip for #376 2020-10-01 10:04:04 -07:00
geeksville
bacc6caf04 wip gps power fixes #376 2020-10-01 09:17:43 -07:00
geeksville
56d4250197 Merge remote-tracking branch 'root/master' into power 2020-10-01 07:51:24 -07:00
geeksville
d66cede7fc Merge branch 'eink' into power 2020-10-01 07:51:01 -07:00
Stefan Venz
f7ffd196e3 Fix update/install instructions 2020-10-01 11:22:41 +02:00
geeksville
3a638090a2 update protos for #376 2020-09-30 07:47:16 -07:00
geeksville
4342ae74fb Merge remote-tracking branch 'root/master' 2020-09-30 07:24:38 -07:00
BeardyWalrus
5150d15997 Merge branch 'master' into master 2020-09-29 19:57:01 -04:00
BeardyWalrus
7d6dbcfa3f Update BluetoothUtil.cpp
fix for #357
use presence of ssd1306 display to set display functionality for bluetooth security.
2020-09-29 19:51:39 -04:00
Kevin Hester
5a7962896d Merge pull request #449 from geeksville/eink
pulling in some common GPS fixes, so I can use them on ESP32
2020-09-29 14:21:00 -07:00
Kevin Hester
cfb9a600e4 Merge branch 'master' into eink 2020-09-29 14:14:10 -07:00
geeksville
7f3217d69e update image build script 2020-09-29 14:12:26 -07:00
Jm Casler
d94be0f534 Merge pull request #448 from mc-hamster/master
Add frequency information to debug output (#447) and cleanup of screen.cpp and meshwifi.cpp
2020-09-29 01:09:55 -07:00
Jm Casler
17a3e6e975 Merge branch 'master' of https://github.com/mc-hamster/Meshtastic-device 2020-09-29 00:59:31 -07:00
Jm Casler
423cbc2c6d Added frequency information to debug output (#447) and cleanup of screen.cpp and meshwifi.cpp 2020-09-29 00:59:26 -07:00
geeksville
124a82888d add power testing notes for eink 2020-09-28 17:38:36 -07:00
geeksville
fec7a6bf17 add air530 gps sleep support 2020-09-28 17:04:19 -07:00
geeksville
bc50b39a3b put eink screen to sleep to save power 2020-09-28 16:08:52 -07:00
geeksville
158e3edbe7 eink generate full image 2020-09-28 15:21:54 -07:00
geeksville
116fe6d109 eink bootloader finished 2020-09-28 15:18:32 -07:00
geeksville
6a4ef7e1d1 eink board serial flash seems to work 2020-09-28 14:10:33 -07:00
geeksville
a0fd83428f eink use RESET button as regular button instead 2020-09-28 13:10:27 -07:00
geeksville
e5d4fbb164 fix pins per email eink 2020-09-28 13:03:54 -07:00
BeardyWalrus
26bafb4082 Merge pull request #3 from meshtastic/master
Update from upstream
2020-09-27 19:23:26 -04:00
Jm Casler
154dd3990c Merge pull request #11 from meshtastic/master
Merge pull request #446 from mc-hamster/master
2020-09-27 09:34:27 -07:00
Jm Casler
78fe41710b Merge pull request #446 from mc-hamster/master
Give more details of why wifi is disconnected & Set device hostname with hardwire ID #445
2020-09-27 01:04:01 -07:00
Jm Casler
1f38404e60 Merge branch 'master' into master 2020-09-27 00:58:12 -07:00
Jm Casler
848760e5bf Set device hostname with hardwire ID #445 2020-09-27 00:55:41 -07:00
Jm Casler
5ebac0cd54 Merge branch 'master' of https://github.com/mc-hamster/Meshtastic-device 2020-09-26 23:38:22 -07:00
Jm Casler
9b4079317b Give more details of why wifi is disconnected 2020-09-26 23:37:58 -07:00
Jm Casler
0f64332f93 Merge pull request #444 from mc-hamster/master
Display gps altitude on display #443
2020-09-26 18:50:00 -07:00
Jm Casler
fd62edbcab Merge branch 'master' into master 2020-09-26 18:44:53 -07:00
Kevin Hester
46abb9ae3f Merge pull request #441 from geeksville/eink
add preiminary support for TTGO eink board
2020-09-26 18:39:35 -07:00
Jm Casler
b5361ef89f Display gps altitude on display #443 2020-09-26 18:37:51 -07:00
geeksville
bf808f57fe add air530 manuals 2020-09-26 18:25:10 -07:00
geeksville
648589ed16 translate important parts of the Air530 datasheet to english 2020-09-26 18:16:32 -07:00
geeksville
28ec0e310d make bat voltage sensing work on eink 2020-09-26 18:13:16 -07:00
geeksville
956d9e96f2 Merge branch 'eink' of https://github.com/geeksville/Meshtastic-esp32 into eink 2020-09-26 13:49:54 -07:00
geeksville
266ba03bb7 route debug output back to the CDC-ACM device instead of JLINK 2020-09-26 13:49:22 -07:00
Kevin Hester
04c54840f4 Merge branch 'master' into eink 2020-09-26 12:58:13 -07:00
geeksville
db33200468 remove more stale eink code 2020-09-26 12:51:05 -07:00
geeksville
d7fbcf89bf cleanup todo eink now ready to merge 2020-09-26 12:36:11 -07:00
geeksville
a8b1bc735a remove debugging code eink gps now works 2020-09-26 12:12:50 -07:00
geeksville
ba8c640d6e eink leds kinda work now 2020-09-26 10:53:02 -07:00
geeksville
d88d2780f4 eink display now kinda works 2020-09-26 09:40:48 -07:00
geeksville
b0bbf95b03 LORA now works on the eink board (new schematic from ttgo) 2020-09-26 07:25:32 -07:00
geeksville
7ca150bf07 personal notes about threading 2020-09-26 06:50:54 -07:00
Jm Casler
9c7aa02db8 Merge pull request #440 from mc-hamster/master
Merging from my fork into master for some cleanup, more code comments, reduce compile warnings and move the "Mode" text up a line.
2020-09-26 00:20:27 -07:00
Jm Casler
6f444ed4b5 Accidently left #include "nimble/BluetoothUtil.h" in screen 2020-09-26 00:03:23 -07:00
Jm Casler
28119bf1bf Fix for #439 and some cleanup 2020-09-26 00:01:02 -07:00
Jm Casler
7fdb5b594d Merge pull request #10 from meshtastic/master
update my fork from head
2020-09-25 16:40:01 -07:00
Kevin Hester
6013fceb10 Merge pull request #438 from geeksville/master
fix TCP API server and get ready to end "region specific" firmware builds
2020-09-25 16:27:29 -07:00
geeksville
2996c7c8e2 Make tcp API now work. Sample usage and caveats below:
Sample usage:

First configure device to use @mc-hamster's new wifi stuff:
meshtastic --set wifi_ssid mylanname --set wifi_password mylanpassword

Then reboot the device (so wifi starts up).

(assuming device was assigned addr 192.168.81.45)
meshtastic --info --host 192.168.81.45
(See the usual device info you previously had to get over USB)

Caveats:

* Currently we are limiting to one active TCP connection open at once, if
you open a new session the old one is closed automatically
* There are no access controls/authentication needed to open a TCP
connection to the device
* Currently main.cpp is kinda dumb about how we should schedule work and
we rely on too many helper loop() functions.  Very soon in my queue
(related to all the other cleanup) is to add a basic notion of coroutines,
so that we can get away from freertos threads and this old school arduino
loop function.  Once that cleanup happens we can the a) have much lower
battery consumption (always) and b) super fast response for all operations.
2020-09-25 16:18:30 -07:00
geeksville
d1c3078698 shrink guard for channel settings lock 2020-09-25 12:52:26 -07:00
geeksville
3e5f81bf2a move region into userpreferences, to end region specific firmwares 2020-09-25 12:52:08 -07:00
geeksville
772d045166 more eink notes 2020-09-25 10:41:27 -07:00
geeksville
1a064a4666 Merge remote-tracking branch 'root/master' 2020-09-25 09:19:58 -07:00
Kevin Hester
e81c89dcae Merge pull request #436 from meshtastic/dev-wifi
Initial Merge of WiFi Soft AP, WiFi Client, HTTP Server, DNS Server, Captive Portal and Apple Captive Network Assistant (CNA)
2020-09-25 09:18:44 -07:00
geeksville
1f36139e99 remove Signal 2020-09-25 09:14:44 -07:00
geeksville
6f77244af3 eink wip notes 2020-09-25 09:14:00 -07:00
Jm Casler
05351ce3e4 Merge branch 'master' into dev-wifi 2020-09-24 17:21:16 -07:00
geeksville
a79aff4778 WIP - I think some pins are wrong, waiting for new schematic 2020-09-24 16:36:07 -07:00
geeksville
86d6f88787 Merge remote-tracking branch 'root/master' into eink 2020-09-24 15:13:08 -07:00
geeksville
5fbeaee0b0 eink kinda builds 2020-09-24 14:36:43 -07:00
Jm Casler
fed4dfd410 Merge pull request #435 from mc-hamster/master
Update dev-wifi from my fork
2020-09-24 11:15:47 -07:00
Jm Casler
0d3b8bdb22 Note not to file bugs 2020-09-24 11:07:30 -07:00
Kevin Hester
3c4f56f3bf Merge pull request #434 from geeksville/dev-wifi
Add stubs so that portduino can build with wifi. cc @mc-hamster
2020-09-24 10:51:39 -07:00
geeksville
d3c00584a2 oops - the NRF52 build rules are suppose to inherit from arduino_base. 2020-09-24 10:36:37 -07:00
Jm Casler
ce7fa65595 David's latest changes to the HTML UI 2020-09-23 19:04:12 -07:00
geeksville
9c0a0ad220 Add stubs so that portduino can build with wifi. cc @mc-hamster 2020-09-23 17:22:17 -07:00
Kevin Hester
22d0ef36b8 Merge pull request #431 from KenVanHoeylandt/patch-1
Fix for broken link to device API docs
2020-09-23 17:12:52 -07:00
Ken Van Hoeylandt
829c5f493c Fix for broken link to device API docs
bluetooth-api.md -> device-api.md
2020-09-23 20:16:21 +02:00
Jm Casler
2d8eb8e205 Merge pull request #9 from meshtastic/dev-wifi
from dev-wifi to my fork
2020-09-22 22:09:06 -07:00
Jm Casler
52a3927585 Merge branch 'master' into dev-wifi 2020-09-22 22:00:55 -07:00
Jm Casler
b39f6c96bd Merge remote-tracking branch 'origin/dev-wifi' 2020-09-22 22:00:07 -07:00
Jm Casler
a96c2e0eac Merge pull request #428 from mc-hamster/master
Initial check-in of David's UI
2020-09-22 21:10:48 -07:00
Jm Casler
10b24c0269 Initial check-in of David's UI 2020-09-22 21:01:31 -07:00
Jm Casler
4140883684 Merge pull request #426 from comgram/kr
Add Korean Frequency
2020-09-22 05:46:18 -07:00
geeksville
3352fae64c fix #371 allow button while using API. also don't let tbeams sleep if they have USB power 2020-09-21 12:41:39 -07:00
comgram
55cb0c52ee Add Korean Frequency 2020-09-21 16:10:20 +09:00
Jm Casler
626d82614c Merge pull request #425 from mc-hamster/master
Fix for - dev-wifi: Detailed error reporting of reason why WiFi didn't connect #424
2020-09-19 22:05:57 -07:00
Jm Casler
d890068acb dev-wifi: Detailed error reporting of reason why WiFi didn't connect #424 2020-09-19 21:58:21 -07:00
Jm Casler
468ad39a94 Merge pull request #7 from meshtastic/dev-wifi
Bringing in the API changes
2020-09-19 17:27:29 -07:00
Jm Casler
5cbe06c2b0 Merge pull request #419 from geeksville/dev-wifi
Add API server on port 4403 (kinda a WIP, seems to work but I haven't
2020-09-19 17:25:24 -07:00
Jm Casler
3412ecfe7b Merge pull request #6 from meshtastic/dev-wifi
Pulling from meshtastic dev-wifi to my work area
2020-09-19 17:21:56 -07:00
Jm Casler
adb16a334c Merge pull request #423 from mc-hamster/master
Add more detail on the connection status on the screen #422
2020-09-19 17:20:35 -07:00
Jm Casler
377f0bda5d Add more detail on the connection status on the screen #422 2020-09-19 17:15:03 -07:00
Jm Casler
51ab853658 Merge pull request #421 from mc-hamster/master
Fix for Bug #420 : Wifi in station mode sometimes enters loops of repeatedly joining
2020-09-19 16:46:05 -07:00
Jm Casler
464a42258f Fix for "Wifi in station mode sometimes enters loops of repeatedly joining... #420"
Fix for Wifi in station mode sometimes enters loops of repeatedly joining... #420
2020-09-19 16:38:59 -07:00
geeksville
9e9c50e6d8 Add API server on port 4403 (kinda a WIP, seems to work but I haven't
finished the python client code)
2020-09-19 12:54:49 -07:00
Jm Casler
945f726b65 Merge branch 'master' of https://github.com/mc-hamster/Meshtastic-device 2020-09-19 12:50:46 -07:00
Jm Casler
7c44daf8f4 pushing my chances to personal branch so i can get the changes from the laptop 2020-09-19 12:50:43 -07:00
Jm Casler
c57a9a8613 Update from my laptop 2020-09-19 11:24:55 -07:00
geeksville
3c0429deee Add new factory_reset preferences option clients can set 2020-09-19 11:19:42 -07:00
Kevin Hester
5d8f541e70 Merge pull request #418 from geeksville/master
1.1.0
2020-09-19 10:33:48 -07:00
geeksville
bd126b866c 1.1.0 2020-09-19 10:32:57 -07:00
Kevin Hester
036a1991b8 Merge pull request #403 from r51n/anz
Add Australia/New Zealand channels and build target
2020-09-19 07:48:17 -07:00
Jm Casler
6e3b22c624 Stub for a handler of the root (/) of the web server with a html table and form for chat 2020-09-18 20:42:35 -07:00
Jm Casler
82fbedbf41 Auto formatting of meshwifi.cpp 2020-09-18 18:51:42 -07:00
Jm Casler
0929b86d62 Merge pull request #411 from mc-hamster/master
Moved handleDNSResponse from main into handleWebResponse and used the auto format
2020-09-18 18:36:40 -07:00
Jm Casler
65fc1cf4a6 Moved handleDNSResponse into handleWebResponse and used the autoformatter 2020-09-18 18:29:16 -07:00
Jm Casler
6f753799fd Merge pull request #410 from mc-hamster/master
Completed Software AP and basic Captive Portal
2020-09-18 18:20:27 -07:00
Jm Casler
4d72afebe6 Soft AP and basic captive portal done. 2020-09-18 18:16:58 -07:00
Jm Casler
b1643e6036 Merge pull request #5 from meshtastic/dev-wifi
Dev wifi
2020-09-18 18:06:13 -07:00
Jm Casler
362d8cb831 Merge branch 'master' into dev-wifi 2020-09-18 18:02:56 -07:00
Jm Casler
b203c95dd1 changes for soft ap + captive portal 2020-09-18 15:33:03 -07:00
Kevin Hester
8d4672964c Merge pull request #409 from geeksville/dev-wifi
Make wifi optional and exclude from nrf52 builds
2020-09-18 13:38:00 -07:00
geeksville
6e5e5822aa Make wifi optional and exclude from nrf52 builds 2020-09-18 10:48:39 -07:00
Kevin Hester
5fb0bf2575 Merge branch 'master' into anz 2020-09-18 10:19:43 -07:00
Kevin Hester
9af2045dc1 Merge pull request #404 from geeksville/master
Merge portduino/sim beginnings into mainline
2020-09-18 10:18:33 -07:00
Kevin Hester
9624cc3798 Merge pull request #405 from mc-hamster/master
Initial Check-in of wifi changes into dev-wifi
2020-09-18 10:18:12 -07:00
geeksville
3541228c1f update to my latest radiolib 2020-09-17 11:41:34 -07:00
geeksville
cc95361fdc Merge remote-tracking branch 'root/master' 2020-09-17 11:24:42 -07:00
geeksville
9b1d1ad0a5 add linux/portduino to the CI test build
Signed-off-by: geeksville <kevinh@geeksville.com>
2020-09-17 11:23:46 -07:00
geeksville
7e467f1466 Merge branch 'portduino' 2020-09-17 11:20:50 -07:00
geeksville
d3e28e3e2c Merge branch 'dev' 2020-09-17 11:20:41 -07:00
r51n
1a1a0fbfbe add ANZ to build list 2020-09-17 12:04:38 +00:00
r51n
91305c2c84 add AU/NZ channel definitions 2020-09-17 12:02:38 +00:00
Jm Casler
48dd6d388d Merge branch 'master' of https://github.com/mc-hamster/Meshtastic-device 2020-09-16 23:16:19 -07:00
Jm Casler
64710a6a04 renamed reconnectWiFi to initWifi 2020-09-16 23:16:11 -07:00
Jm Casler
c83ff03d66 Merge pull request #4 from meshtastic/master
Updating form head
2020-09-16 22:51:19 -07:00
Jm Casler
73b47a78aa Clean up and added comments about the esp32 sdk bug 2020-09-16 22:31:07 -07:00
Jm Casler
493b25f23e Final checkin of WiFi and basic HTTP server 2020-09-16 20:15:00 -07:00
Kevin Hester
004f1f625b Merge pull request #398 from geeksville/master
misc atomic bug fixes - see commits
2020-09-16 10:10:00 -07:00
geeksville
fc20f658e6 Fix #362 by @a-f-G-U-C - I was mispelling NMEA ;-) 2020-09-16 09:22:03 -07:00
geeksville
8e988cc926 fix #397 from @a-f-G-U-C - bogus GPS positions during locking could be reported
btw - from my read of the NMEA, the lowest value that means 'has a valid
position' is 1 not 2.  But I only know this because you pointed me at
it ;-)

Thanks!
2020-09-16 09:18:44 -07:00
geeksville
8c240b59f6 fix #393. immediately save node db to disk if user changes name 2020-09-16 09:08:35 -07:00
geeksville
f847e30a3c Merge remote-tracking branch 'root/master' 2020-09-16 09:04:27 -07:00
geeksville
7050ae4ba1 Merge branch 'master' into portduino 2020-09-15 21:14:42 -07:00
geeksville
3e64d8439d Merge branch 'master' into dev 2020-09-15 21:13:24 -07:00
geeksville
435c955acd make hash prototype a bit stricter 2020-09-15 21:05:57 -07:00
Jm Casler
c656a95a84 Merge pull request #3 from meshtastic/master
Update from meshtastic main
2020-09-15 20:34:30 -07:00
Jm Casler
27ad8472c1 remove ssid info from configuration.h 2020-09-15 20:24:58 -07:00
Jm Casler
3fcd4a61aa commenting out the strcpy to manually set the wifi info. 2020-09-15 20:24:03 -07:00
geeksville
c6d93d1a28 fix #346 limit tx power in japan 2020-09-15 18:54:50 -07:00
Kevin Hester
b0c82dcb5b Merge pull request #394 from geeksville/master
misc bug fixes
2020-09-15 18:19:58 -07:00
geeksville
7d4058f49d let users set 20 dBm if they wish 2020-09-15 18:00:21 -07:00
geeksville
31fc8fafec make default power level radio chipset specific 2020-09-15 17:55:33 -07:00
geeksville
313cee9a3f update webpage 2020-09-15 17:54:55 -07:00
Jm Casler
066d9d48a4 New method to deinit the wifi stack. 2020-09-14 20:27:49 -07:00
geeksville
16de4a0d2e Merge remote-tracking branch 'root/master' 2020-09-14 09:25:31 -07:00
geeksville
621fcb598e Declare 1.0 2020-09-14 09:25:14 -07:00
Jm Casler
b2a6a4000b Merge pull request #2 from meshtastic/master
Updating from head
2020-09-14 00:05:21 -07:00
Jm Casler
f5c939fb10 Fix to turn WiFi back on after the bluetooth radio is reenabled. 2020-09-13 22:22:49 -07:00
Jm Casler
e508306395 Refactoring to break out HTTP from WiFi 2020-09-13 16:58:36 -07:00
Kevin Hester
cc6b500029 Merge pull request #388 from geeksville/master
1.0.0
2020-09-13 12:11:32 -07:00
geeksville
887b1b5dcd Merge remote-tracking branch 'root/master' 2020-09-13 11:58:31 -07:00
geeksville
62e333b235 1.0.0 2020-09-13 11:53:31 -07:00
Jm Casler
d859700497 Merge branch 'master' into master 2020-09-12 21:55:01 -07:00
Jm Casler
f129b458ad Initial Checkin for WiFi and HTTP Server Framework 2020-09-12 21:43:41 -07:00
Kevin Hester
bf68ad7cf5 Merge pull request #382 from geeksville/master
0.9.7
2020-09-12 10:31:19 -07:00
geeksville
6d9bdbb628 0.9.7 2020-09-12 10:21:44 -07:00
Kevin Hester
6782c2d3d1 Merge pull request #380 from mc-hamster/master
Fix for screen crashing after GPS lock.
2020-09-12 10:20:13 -07:00
Jm Casler
b6f71ca1db Update screen.cpp for for crash when gps gets lock
Update screen.cpp for for crash when gps gets a lock
2020-09-11 22:17:45 -07:00
geeksville
92df77f228 Merge remote-tracking branch 'root/master' into dev 2020-09-11 18:15:13 -07:00
Jm Casler
caeea41867 Merge pull request #1 from meshtastic/master
Merge from original repo
2020-09-11 17:59:02 -07:00
Kevin Hester
bc17dd1a0f Merge pull request #378 from geeksville/master
0.9.6
2020-09-11 13:41:09 -07:00
geeksville
2a3175470b merge remote-tracking branch 'root/master' 2020-09-11 13:31:28 -07:00
geeksville
8ca6bbfb78 0.9.6 2020-09-11 13:30:44 -07:00
Kevin Hester
9777762052 Merge pull request #368 from geeksville/master
misc bug fixes
2020-09-11 11:42:51 -07:00
geeksville
da01f0ab7f Merge remote-tracking branch 'mine/master' 2020-09-10 10:11:53 -07:00
geeksville
1cd81208c0 Merge remote-tracking branch 'root/master' 2020-09-10 10:11:15 -07:00
Kevin Hester
2394075d94 Merge branch 'master' into master 2020-09-10 10:11:04 -07:00
geeksville
de7b9877f9 remove auto-inserted whitespace that might confuse platformio 2020-09-10 09:51:53 -07:00
geeksville
ee27c15c2c likely fix for bug #373. fix #339. great gps fixes from @a-f-G-U-C
fixes described in bug #376
2020-09-10 09:25:10 -07:00
geeksville
076f8bd77b fix #370 by pulling in my bugfix to ESP32-Nimble 2020-09-09 14:15:43 -07:00
Kevin Hester
288363b3a6 Merge pull request #369 from gkelly/fix-no-button
Fix compilation without a BUTTON_PIN definition
2020-09-08 12:49:24 -07:00
Garret Kelly
48256d6e9e Fix compilation without a BUTTON_PIN definition 2020-09-08 15:22:49 -04:00
geeksville
c007302564 fix #363 gps altitude - based on tip by @a-f-G-U-C 2020-09-08 10:28:53 -07:00
geeksville
0a9f7147f3 probably fix #341 enable internal pullup on lora-v2 button 2020-09-08 10:25:37 -07:00
geeksville
46ba36511a Merge branch 'portduino' into dev
# Conflicts:
#	platformio.ini
2020-09-07 16:31:17 -07:00
Kevin Hester
170f0693c6 Merge pull request #366 from mc-hamster/master
New screen to fix issue #352
2020-09-07 15:31:16 -07:00
Kevin Hester
d900509fbc Merge branch 'master' into master 2020-09-07 15:26:35 -07:00
Kevin Hester
8018c27dcd Merge pull request #367 from geeksville/master
test fixing CI build
2020-09-07 15:26:24 -07:00
geeksville
8df5ac9d3f pull in my fixed nrf52 platform 2020-09-07 15:22:00 -07:00
geeksville
c3196f47ef Merge remote-tracking branch 'root/master' 2020-09-07 15:13:09 -07:00
geeksville
81a49d4e3c Merge branch 'post1' 2020-09-07 15:12:14 -07:00
Kevin Hester
4f32c36db8 Merge branch 'master' into master 2020-09-07 15:04:01 -07:00
Kevin Hester
5db0bb3368 Merge pull request #361 from drewsed/add-new-cases-to-both-README
Added a new 3D printable case to \README.md and updated \docs\README.md fixes #360
2020-09-07 15:02:55 -07:00
geeksville
f3d38d84c9 fix nrf52 build 2020-09-07 13:03:37 -07:00
geeksville
f8bb6bbcb4 try to bang on SPI from simulator 2020-09-06 16:32:13 -07:00
geeksville
e0d5b9dce1 use simradio on portduino 2020-09-06 16:09:07 -07:00
geeksville
94e4b30125 add crude sim getmacaddr 2020-09-06 16:07:32 -07:00
geeksville
2a067e7f6b make gps optional. Portduino almost works in sim! 2020-09-06 14:45:43 -07:00
geeksville
97ab07e05c WIP 2020-09-06 10:09:40 -07:00
geeksville
b8d39845cf portduino now links! 2020-09-06 09:24:08 -07:00
Jm Casler
cbea36a151 Merge branch 'master' into master 2020-09-05 22:53:03 -07:00
Jm Casler
49dea6d6bd Update Screen.cpp
Added commnets for concepts for future TODO work.
2020-09-05 22:36:57 -07:00
Jm Casler
7d4c6c7086 Update Screen.cpp
- Changed "No Satellite Lock" to "No GPS Lock"
- Fixed bug when there's no battery. Now shows "USB"
- Tested on tlora-v1
2020-09-05 14:41:00 -07:00
geeksville
fefd3d78f3 Portduino WIP now compiles but does not link 2020-09-05 12:34:48 -07:00
Jm Casler
f41a77c46d Initial add of status screen
Initial add of the status screen.

TODO:
- Get status of the BT Radio
- Display something on line 3
2020-09-05 09:30:18 -07:00
geeksville
6a475d8288 WIP 2020-09-04 17:23:17 -07:00
geeksville
c629b94333 portduino WIP 2020-09-04 15:03:22 -07:00
drewsed
5423f4e06c Added a new 3D printable case to \README.md and updated \docs\README.md 2020-09-04 10:41:22 +02:00
Kevin Hester
88f8bbe21e Merge pull request #358 from Dafeman/master
Update build instructions
2020-09-02 14:36:13 -07:00
Dafeman
eda4862f0d Update build-instructions.md 2020-09-03 08:34:52 +12:00
Dafeman
7ca752cd32 Merge pull request #5 from meshtastic/master
Merge latest
2020-09-03 08:14:37 +12:00
Kevin Hester
c5ffebc498 Merge pull request #355 from geeksville/master
stop using post1 for now (it was a dumb idea)
2020-09-01 16:33:17 -07:00
geeksville
baa12aa5b3 Merge branch 'master' into post1 2020-09-01 08:54:39 -07:00
geeksville
ccf3522ada Merge remote-tracking branch 'root/master' 2020-09-01 08:53:31 -07:00
geeksville
d14cf5aa94 Merge remote-tracking branch 'root/post1' 2020-09-01 08:53:26 -07:00
geeksville
810429b54f Merge branch 'master' into post1 2020-08-31 09:10:24 -07:00
Kevin Hester
915427c964 Merge pull request #350 from geeksville/master
misc bugfix
2020-08-30 14:43:48 -07:00
geeksville
347484baaf 0.9.5 2020-08-30 14:38:23 -07:00
geeksville
bb6913a56a Merge remote-tracking branch 'root/master' 2020-08-30 13:48:16 -07:00
geeksville
6cdaf8c600 fix #349 channel suffix letter didn't match between device and phone 2020-08-30 12:38:15 -07:00
geeksville
c370eb4a88 allow restarting failed upgrades (fixes an android autobug report) 2020-08-30 12:21:05 -07:00
geeksville
8dc4492ba3 add taiwan frequencies 2020-08-30 12:20:43 -07:00
geeksville
901cc536ef less logspam 2020-08-29 15:17:32 -07:00
Kevin Hester
41c2732e4f Merge pull request #347 from geeksville/post1
Post1
2020-08-29 13:13:40 -07:00
Kevin Hester
2d12a363db Merge pull request #348 from geeksville/master
finish (ish) corvus board
2020-08-29 13:13:25 -07:00
geeksville
28455f0056 Merge branch 'master' into post1 2020-08-29 12:47:27 -07:00
geeksville
5125126aec Merge branch 'corvus' 2020-08-29 12:47:01 -07:00
geeksville
f1ca1ee3c0 okay basic support for @bigcorvus board is done 2020-08-29 12:46:42 -07:00
geeksville
dffb6c2f06 If display is on on the @BigCorvus board and we xmit the board browns out? 2020-08-28 17:38:23 -07:00
geeksville
7f214ffbb0 TFT kinda correct now - but slow because of bit banging 2020-08-28 15:33:33 -07:00
geeksville
e049eac38a TFT display kinda draws stuff (badly) 2020-08-28 15:06:52 -07:00
geeksville
338445d175 basic init of the Corvus TFT display works 2020-08-28 14:24:22 -07:00
Kevin Hester
8eb492d356 Merge pull request #345 from geeksville/post1
update from master
2020-08-27 14:56:28 -07:00
Kevin Hester
a5341d766e Merge pull request #344 from geeksville/master
lora32 again
2020-08-27 14:56:18 -07:00
geeksville
c78142b235 Merge remote-tracking branch 'root/post1' into post1 2020-08-27 14:50:54 -07:00
geeksville
9ebaa2b962 Merge remote-tracking branch 'root/master' 2020-08-27 14:49:52 -07:00
geeksville
79498580b1 If LORA32 battery voltage is super low, assume no battery installed 2020-08-27 14:46:59 -07:00
Kevin Hester
41901aed97 Merge pull request #342 from geeksville/master
ttgo lora32 fixes
2020-08-26 14:06:25 -07:00
geeksville
2729a513ab Merge remote-tracking branch 'root/master' 2020-08-26 14:00:43 -07:00
geeksville
af046e7dbd bug #322 - ttgo lora32 deep sleep
oh - I think I found the problem (probably)!  we were isolating gpio12 (which isn't used on other boards) to save power during sleep.  gpio12 is the button for this board. @thomslik would you mind pulling this commit and seeing if it works better?
2020-08-26 14:00:10 -07:00
Kevin Hester
0caf534b65 Merge pull request #338 from geeksville/master
fix heltec battery display
2020-08-25 13:06:32 -07:00
geeksville
f650222e94 Merge remote-tracking branch 'root/master' 2020-08-25 13:01:19 -07:00
geeksville
5c40378805 fix #336 don't send battery status on nodes without batteries 2020-08-25 13:00:55 -07:00
geeksville
780b7e3628 don't show battery status on boards that can't sense that #336 2020-08-25 12:48:47 -07:00
geeksville
83ae3c7714 doc rename 2020-08-25 12:48:19 -07:00
Kevin Hester
25ebb9adb8 Merge pull request #337 from geeksville/master
fix screen redrawing
2020-08-25 12:14:07 -07:00
geeksville
7f6a0e7ddc Merge remote-tracking branch 'root/master' 2020-08-25 12:08:38 -07:00
geeksville
f62e6793c5 Fix #333 screens were redrawing when they should not
thanks @drewsed for the clear report - made it easy to repro/fix
due to refactoring/cleanup a couple of weeks back
2020-08-25 12:08:18 -07:00
geeksville
babd57ecde add hw docs 2020-08-25 12:06:55 -07:00
geeksville
de196810a2 add debugging for SNR values on SX1262 2020-08-25 12:06:36 -07:00
Kevin Hester
82fe55471d Merge pull request #331 from geeksville/master
hotfix
2020-08-22 09:15:51 -07:00
Kevin Hester
83726086a9 Merge pull request #329 from geeksville/post1
Post1
2020-08-22 09:13:55 -07:00
geeksville
60d90c4533 Merge remote-tracking branch 'root/master' 2020-08-22 09:10:33 -07:00
geeksville
9145945efa 0.9.3 2020-08-22 09:10:08 -07:00
geeksville
7b09fbe049 fix #327 side effect noticed by @smarti2019 2020-08-22 09:06:54 -07:00
geeksville
a90bab5455 this seems bad - this value was not inited if it wasn't in bss 2020-08-21 10:56:54 -07:00
Kevin Hester
3d9cc8a056 Merge pull request #328 from geeksville/master
for 0.9.2
2020-08-21 10:52:14 -07:00
geeksville
ff885ef215 Merge remote-tracking branch 'root/post1' 2020-08-21 10:50:49 -07:00
Kevin Hester
eb4286b560 Merge pull request #325 from geeksville/ttgo1262
Add support for SX1262 based TBEAMs, see below for more details.
2020-08-21 10:49:02 -07:00
geeksville
9c90de0f6f 0.9.2 2020-08-21 10:25:34 -07:00
geeksville
d7a1cef046 fix #327 always factory reset the GPS once 2020-08-21 10:14:03 -07:00
geeksville
6a359e2124 don't keep uf2 files in source control 2020-08-21 09:37:41 -07:00
geeksville
ca75dcd64d Add support for SX1262 based TBEAMs, see below for more details.
We probe dynamically for the SX1262 or RF95 based radios on TBEAM1.0
boards now.  If either is present it will be used.
2020-08-20 15:42:36 -07:00
Kevin Hester
aba05ba5ce Merge pull request #324 from geeksville/master
merge from dev
2020-08-17 17:20:16 -07:00
Kevin Hester
99882a675b Merge pull request #323 from geeksville/post1
Post1
2020-08-17 15:28:26 -07:00
geeksville
9c9347df23 don't reference tft libs on devices that don't have it 2020-08-17 14:06:31 -07:00
geeksville
b66856c53f default back to tbeam 2020-08-17 14:01:53 -07:00
geeksville
285069703c add missing button 2020-08-17 14:01:03 -07:00
geeksville
d91ab5480f begin support for TFT displays 2020-08-17 13:47:05 -07:00
geeksville
e3b74ece74 use the lora-relay board for CI builds 2020-08-17 12:38:53 -07:00
geeksville
66557241f3 Generate UF2 files for NRF52 release builds 2020-08-17 12:29:45 -07:00
geeksville
3c09c3e520 show NRF52840 debug output via the USB CDC-ACM device 2020-08-17 11:50:50 -07:00
geeksville
781077e799 Turn on buck converter for @BigCorvus board, now radio works 2020-08-17 11:42:19 -07:00
geeksville
22946b5e51 @BigCorvus board now kinda boots
###RTT Client: -----------------------------------------------
###RTT Client: Connecting to J-Link RTT Server via localhost:19021 ...
###RTT Client: Connected.

SEGGER J-Link V6.70c - Real time terminal output
SEGGER J-Link ARM V9.6, SN=69663845
Process: JLinkGDBServerCLExe
Emitting reboot packet for serial shell
I2C device found at address 0x55
done
Meshtastic swver=unset, hwver=unset
Reset reason: 0x0
FIXME, call randomSeed
ERROR: No UBLOX GPS found
Hoping that NEMA might work
RadioConfig reset!
Initial packet id 1481765933, numPacketId 4294967295
No saved preferences found
NODENUM=0xB18C3A4E, dbsize=1
Starting meshradio init...
Set radio: name=Default, config=3, ch=6, power=17
SX1262 init result 0
sending owner !df5db18c3a4e/Unknown 3a4e/?4E
Update DB node 0xB18C3A4E, rx_time=0
old user !df5db18c3a4e/Unknown 3a4e/?4E
updating changed=0 user !df5db18c3a4e/Unknown 3a4e/?4E
Adding packet record (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim3 Payload:User)
enqueuing for send (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim3 encrypted)
txGood=0,rxGood=0,rxBad=0
Starting low level send (id=0x5851F430 Fr0x4E To0xFF, WantAck0, HopLim3 encrypted)
assert failed src/mesh/SX1262Interface.cpp: 102, virtual void SX1262Interface::setStandby(), test=err == ERR_NONE
2020-08-17 11:29:00 -07:00
geeksville
c0307cbcb0 a cleaner way to add variants - no longer need symlinks in adafruit proj 2020-08-17 10:23:21 -07:00
geeksville
6b568ab2fb add powerhold for @bigcorvus board 2020-08-16 14:50:04 -07:00
geeksville
67bad9a689 Add SX1262 to @BigCorvus board 2020-08-16 14:20:05 -07:00
geeksville
559a790286 Add @BigCorvus board support to build 2020-08-16 14:08:31 -07:00
geeksville
08e5bd728b lorarelay wip 2020-08-16 14:07:01 -07:00
geeksville
0cfeeba2e2 add variant files by @BigCorvus 2020-08-16 13:25:24 -07:00
geeksville
5007624ba5 Merge remote-tracking branch 'root/post1' into post1 2020-08-16 13:21:54 -07:00
Kevin Hester
bba4677915 Merge pull request #318 from geeksville/master
fix 279
2020-08-13 20:08:13 -07:00
geeksville
ac969cdb26 Merge remote-tracking branch 'root/master' 2020-08-13 19:56:41 -07:00
geeksville
1c3eff0ee5 turn on fix #279 for tbeam0.7 and ttgo lora32-1.6 battery levels 2020-08-13 19:55:57 -07:00
Kevin Hester
cba9546a4d Merge pull request #316 from geeksville/master
for bug #279
2020-08-13 11:30:25 -07:00
geeksville
ceae60cf13 Merge remote-tracking branch 'root/master' 2020-08-13 11:25:11 -07:00
geeksville
3de1607cea bug #279 change battery voltage to millivolts 2020-08-13 11:23:27 -07:00
Kevin Hester
029b2f3139 Merge pull request #313 from geeksville/post1
Post1
2020-08-12 21:35:42 -07:00
Kevin Hester
ab6c97bfef Merge pull request #315 from geeksville/master
misc bug fixes
2020-08-12 21:35:31 -07:00
Kevin Hester
a61b15e861 Merge branch 'post1' into post1 2020-08-12 17:24:58 -07:00
geeksville
8c7aa07c70 Only do AXP debugging on ESP32 targets 2020-08-12 17:10:59 -07:00
geeksville
6a402b13fa Add battery sensing (mostly) for TBEAM0.7
However, disabled until someone with suitable hardware can test and report
back.

@slavino and @tschundler would you be willing to try it with your boards?

You'll need to uncomment the following line in configuration.h

// #define BATTERY_PIN 35 // A battery voltage measurement pin, voltage divider connected here to measure battery voltage
2020-08-12 17:03:36 -07:00
geeksville
c30b570e16 Merge remote-tracking branch 'root/master' 2020-08-12 15:53:23 -07:00
geeksville
9b25818a50 fix #249: report battery levels even if no GPS lock
@professr I noticed you added a "newStatus" observable to the GPS class.
Do you remember why you didn't remove the old GPS status (which seemed
to be dumber).  Is it just because you didn't want to risk breaking
MeshService?  (I assume) In this change I removed the old Observable
and all seems well (just using newStatus everywhere).
2020-08-12 15:51:57 -07:00
Kevin Hester
5311e44660 Merge pull request #314 from geeksville/master
my bug queue
2020-08-12 11:11:01 -07:00
geeksville
55dafcbecb fix #269 see below
/**
 * Generate a short suffix used to disambiguate channels that might have the same "name" entered by the human but different PSKs.
 * The ideas is that the PSK changing should be visible to the user so that they see they probably messed up and that's why they
their nodes
 * aren't talking to each other.
 *
 * This string is of the form "#name-XY".
 *
 * Where X is a letter from A to Z (base26), and formed by xoring all the bytes of the PSK together.
 * Y is not yet used but should eventually indicate 'speed/range' of the link
 *
 * This function will also need to be implemented in GUI apps that talk to the radio.
 *
 * https://github.com/meshtastic/Meshtastic-device/issues/269
 */
const char *getChannelName();
2020-08-12 11:04:03 -07:00
geeksville
178958c165 allow advanced users to specify channel numbers if they wish 2020-08-12 10:46:44 -07:00
geeksville
d7cf7e2eb4 Allow advanced users to set arbitrary spreadfactor/codingrate/bandwidth 2020-08-12 10:42:25 -07:00
geeksville
fce8c16d52 Merge remote-tracking branch 'mine/post1' into post1 2020-08-11 19:21:07 -07:00
geeksville
b690868bb1 Merge branch 'master' into post1 2020-08-11 19:20:46 -07:00
geeksville
dec88a368b First attempt at better protocol docs. Bug #308
@cyclomies thank you for the prodding and help.  I'm happy to add more
detail, can you insert a few questions inline?  Then I'll answer and
hopefully that will be enough to be useful for others.
2020-08-11 17:34:49 -07:00
Kevin Hester
17394d8c1c Merge pull request #307 from geeksville/post1
Add accidentally lost support for the PPR nrf52 board - so Corvus can use it as a reference
2020-08-10 09:20:53 -07:00
Kevin Hester
a7da7cd32e Merge branch 'post1' into post1 2020-08-10 09:15:49 -07:00
Kevin Hester
f37dc9c776 Merge pull request #310 from Dafeman/PlatformIO-build-guide-update
PlatformIO build guide update
2020-08-10 09:12:11 -07:00
Kevin Hester
d6658dbb2e Merge branch 'master' into PlatformIO-build-guide-update 2020-08-10 08:56:15 -07:00
Dafeman
05531b2684 Update build-instructions.md 2020-08-09 14:07:42 +12:00
Dafeman
8b1fb39ce1 Update build-instructions.md 2020-08-06 22:06:38 +12:00
Dafeman
da46d4ca0e Update build-instructions.md 2020-08-06 19:44:42 +12:00
geeksville
047141eb34 make TXEN/RXEN immediately low once changed to be outputs 2020-08-03 11:29:26 -07:00
geeksville
cb1053850d Oops - I mismerged at somepoint, restore correct PPR variant.h defs 2020-08-03 11:05:24 -07:00
Kevin Hester
7652331e8c Merge pull request #306 from geeksville/master
less logspam
2020-08-02 13:38:23 -07:00
geeksville
12bf3795ea less logspam when debugging the serial API 2020-08-02 12:55:22 -07:00
Ellie Hussey
7f45184d90 Fixed message text wrapping, compass rose position, and added device ID on status page (#300) 2020-08-01 10:50:06 -07:00
geeksville
829763af2c remove stale comment 2020-07-30 09:35:07 -07:00
geeksville
75806ee666 clarify build instructions 2020-07-29 10:25:20 -07:00
Kevin Hester
91ec29db03 Merge pull request #301 from ColPanic/flash_improvements
Adding port/help flags and error checking
2020-07-27 11:33:06 -07:00
Todd Allen
d191b12801 Adding port/help flags and error checking 2020-07-27 09:14:04 -04:00
Kevin Hester
e0d6456618 Merge pull request #299 from jasonfish/add-new-case-to-readme
Adding new case URL to Readme
2020-07-26 09:15:38 -07:00
Jason Fish
70eda2ee06 Adding new case URL to Readme 2020-07-26 08:39:37 -07:00
geeksville
7c4eb3eddd add amazon appstore link 2020-07-24 15:08:10 -07:00
Kevin Hester
661a75d796 Merge pull request #298 from geeksville/master
oops - I missed some 0.9.1 files in the last merge into master
2020-07-24 13:35:25 -07:00
geeksville
b617010a46 Merge branch 'post1'
# Conflicts:
#	docs/software/TODO.md
#	docs/software/nrf52-TODO.md
2020-07-24 13:07:33 -07:00
Kevin Hester
5a70c45a3e Merge pull request #297 from geeksville/master
Pull in NimBLE changes into master
2020-07-24 12:59:06 -07:00
geeksville
cb2b36811a Merge remote-tracking branch 'root/master' 2020-07-24 12:50:39 -07:00
geeksville
92edcb97ed Merge remote-tracking branch 'origin/post1'
# Conflicts:
#	docs/software/TODO.md
#	docs/software/nrf52-TODO.md
2020-07-24 12:49:24 -07:00
Kevin Hester
7f1ec15cab Merge pull request #296 from geeksville/nimble
Change BLE implementation to NimBLE rather than Bluedroid
2020-07-24 12:46:37 -07:00
geeksville
1aa7451866 0.9.1 2020-07-24 12:41:14 -07:00
geeksville
d5c46dc114 use max mtusize for speed 2020-07-24 12:39:48 -07:00
geeksville
5bab16636d Switch to NimBLE from Bluedroid
Meshtastic patched version esp-idf commit #e7f316d5a4eb64ca52d40575cb20815d456a9c4f
    used.

    In support of: https://github.com/meshtastic/Meshtastic-device/issues/266
2020-07-24 12:39:35 -07:00
geeksville
204f2c1a68 software update service now registered with NimBLE 2020-07-24 11:39:48 -07:00
geeksville
a5b7501a4e nimble add debug output 2020-07-24 10:12:25 -07:00
geeksville
b0e2c81666 nimble software update WIP builds 2020-07-23 15:57:31 -07:00
geeksville
00ca351169 WIP begin changing software update service over to nimble 2020-07-23 13:01:31 -07:00
geeksville
0415a3c369 Clean up nimble files 2020-07-23 08:10:36 -07:00
geeksville
4eb27b637d Nimble sleep now works nicely 2020-07-22 22:18:47 -07:00
geeksville
107b56a346 move bluetooth enable 2020-07-22 21:41:56 -07:00
geeksville
abdc4dfae8 remove old mesh ble service 2020-07-22 21:29:32 -07:00
geeksville
014eea2f56 Nimble sleep almost works 2020-07-22 21:26:32 -07:00
geeksville
9b4ca95660 nimble basically works now. Started long bake for bug #266 2020-07-22 18:00:56 -07:00
geeksville
78ff9a8116 Nimble WIP - make notify work 2020-07-22 16:40:00 -07:00
geeksville
66b147fb31 Nimble WIP fix bluetooth pairing screen 2020-07-22 16:16:28 -07:00
geeksville
c5df1bc885 Nimble WIP - woot! basic device API works now 2020-07-22 15:44:45 -07:00
geeksville
00cf3a768e nimble WIP turn on bonding and security 2020-07-22 13:50:30 -07:00
geeksville
b6a3deb341 nimble WIP - writes kinda work now 2020-07-22 12:08:54 -07:00
geeksville
531f488fe8 WIP nimble ugly but advertise works 2020-07-22 10:46:01 -07:00
geeksville
d674aaaa29 sometimes save config fails on ublox, don't cause a reboot for that 2020-07-22 10:45:38 -07:00
geeksville
7f6dc104f0 nimble WIP - add advertising boilerplate 2020-07-22 09:51:57 -07:00
geeksville
102085808f WIP nimble now builds 2020-07-21 12:42:24 -07:00
geeksville
2645730329 Merge branch 'post1' into nimble
# Conflicts:
#	docs/software/TODO.md
#	docs/software/nrf52-TODO.md
#	platformio.ini
#	src/esp32/MeshBluetoothService.cpp
2020-07-21 11:20:09 -07:00
geeksville
6aa28f55dd WIP stubify to get app building without CONFIG_BLUEDROID (BLE disabled) 2020-07-21 11:16:14 -07:00
geeksville
1e86365167 MITM_BOND supposedly doesn't have the problem mentioned in #266
(and it is good / more secure anyways - the old code was just
based on the example docs)
2020-07-19 15:01:15 -07:00
geeksville
62c20f8ab9 add todo items 2020-07-19 14:59:53 -07:00
Kevin Hester
7706f65921 Merge pull request #294 from geeksville/master
fix build for non tbeams
2020-07-18 17:12:02 -07:00
geeksville
68490336b8 0.8.2 2020-07-18 16:28:14 -07:00
geeksville
20ac8d71fd make PSRAM optional - new flag in ESPIDF - fix #293 2020-07-18 16:26:43 -07:00
geeksville
ec082b7c9a 0.8.2 2020-07-18 16:26:03 -07:00
geeksville
ece75d1d7f make PSRAM optional - new flag in ESPIDF - fix #293 2020-07-18 16:25:53 -07:00
geeksville
9e10ce487c Merge branch 'master' into post1 2020-07-18 13:32:30 -07:00
Kevin Hester
d248c6be4b Merge pull request #290 from geeksville/master
get ready for release 0.8.1
2020-07-18 13:24:11 -07:00
geeksville
39b0a89821 0.8.1 2020-07-18 13:19:35 -07:00
geeksville
d9f43d3e2f update protobufs related to https://github.com/meshtastic/Meshtastic-device/issues/269 2020-07-18 09:12:51 -07:00
Kevin Hester
94f03bee01 Merge pull request #289 from geeksville/post1
geeksvilles periodic merging from master
2020-07-18 08:58:13 -07:00
geeksville
08c77caaa9 fix #266 ble forced to re-pair details below
The NVS copies of hte BLE pairing info for clients were getting corrupted
occasionally.  So I went googling and found some plausible bug reports
but nothing that was an exact match.  Then I looked at the arduino-esp32
binaries for the ESP-IDF framework.  They were fairly old (Jan 20).

Looking through the commits on ESP-IDF release3.3 it seems like there have
been a few fixes for mutual exclusion errors wrt bluetooth.  So I punted
and tried updating ESP-IDF to latest and everything seems fairly solid
now.  Currently running a long test run with three nodes.
2020-07-18 08:54:52 -07:00
geeksville
cfedc97cd0 Show NVS flash utilization at boot (for debugging ble things?) 2020-07-18 08:49:42 -07:00
geeksville
cfad226b2b use new ttgo-lora build names 2020-07-17 14:11:27 -07:00
geeksville
859642d2e4 Merge remote-tracking branch 'root/master' into post1
# Conflicts:
#	src/configuration.h
2020-07-17 12:06:57 -07:00
Kevin Hester
8316419a01 Merge pull request #288 from geeksville/post1
Improvements for NRF52 targets
2020-07-17 11:22:20 -07:00
Kevin Hester
96f5069742 Merge branch 'post1' into post1 2020-07-17 11:17:12 -07:00
geeksville
e433249bb1 Default back to tbeam in builds, so it will work for others 2020-07-17 11:14:18 -07:00
geeksville
2a6df797ca NRF52 BLE API now works! 2020-07-17 11:12:05 -07:00
geeksville
28aa48c8d2 NRF52 reads now work, but not long reads 2020-07-17 10:40:03 -07:00
geeksville
582f77e4ec NRF52 BLE now works, except for reads having the wrong payload 2020-07-17 10:02:07 -07:00
geeksville
5700cf96d5 redefine printf to use the segger output system (NRF52) 2020-07-17 09:14:23 -07:00
geeksville
769a98f1f4 nrf52 ble - move service in into the scan info 2020-07-17 09:13:47 -07:00
Kevin Hester
4ee35a0612 Merge pull request #280 from aHVzY2g/master
fix #272 add support for tlora-v2-1-1.6
2020-07-16 11:12:40 -07:00
Kevin Hester
64f6741f82 Merge pull request #282 from slavino/patch-7
Create SupportedHardware.md
2020-07-16 11:11:44 -07:00
Kevin Hester
6ad5abcab2 Merge branch 'post1' into patch-7 2020-07-15 21:28:13 -07:00
Kevin Hester
5480f10184 Merge pull request #283 from slavino/patch-8
Update README.md
2020-07-15 21:27:44 -07:00
Kevin Hester
41dfbdd331 Merge branch 'post1' into patch-8 2020-07-15 21:22:21 -07:00
Kevin Hester
903268c52a Merge pull request #281 from slavino/patch-6
Update README.md
2020-07-15 21:21:50 -07:00
Kevin Hester
b60c630922 Merge branch 'post1' into patch-6 2020-07-15 21:16:22 -07:00
Kevin Hester
95588b420c Merge branch 'post1' into patch-8 2020-07-15 21:15:52 -07:00
Kevin Hester
b141ec2e35 Merge pull request #285 from Professr/issue#284
UBlox GPS now detects loss of lock
2020-07-15 21:15:19 -07:00
geeksville
3d0c611896 android app can now talk to NRF52, but writes are lost WIP 2020-07-15 17:09:09 -07:00
geeksville
6cb92143ec OOM allocing the BLE stack for adafruit 2020-07-15 13:45:57 -07:00
geeksville
f919eb6a64 Install a hardfault handler on NRF52 2020-07-15 13:29:09 -07:00
geeksville
4147786b12 WIP of adding NRF52 bluetooth API, we take a hardfault in Bluefruit init 2020-07-15 13:10:56 -07:00
geeksville
3400bcde85 Merge branch 'master' into post1
# Conflicts:
#	docs/README.md
2020-07-15 11:51:05 -07:00
Professr
e5fac4b78d UBlox GPS now detects loss of lock 2020-07-14 22:53:36 -07:00
Slavomir Hustaty
4d20865c67 Update README.md
the board referenced in that "buy" link has also label reference on board stating that it is V1.1
2020-07-14 18:28:14 +02:00
Slavomir Hustaty
8b4cf91f1f Create SupportedHardware.md
idea on supported hardware matrix - maybe to be referenced from main README.md
2020-07-14 18:20:13 +02:00
Slavomir Hustaty
6a6a10fb9b Update README.md 2020-07-14 17:26:17 +02:00
Marlon Spangenberg
44749470a4 fix #272 add support for tlora-v2-1-1.6 2020-07-14 16:16:49 +02:00
Kevin Hester
8fe714d8b1 Merge pull request #278 from geeksville/master
Fix URL
2020-07-13 17:58:42 -07:00
Kevin Hester
22137ff1bd Merge branch 'master' into master 2020-07-13 17:56:08 -07:00
geeksville
da3b6d1958 Fix URL 2020-07-13 17:55:30 -07:00
geeksville
c7213fb710 Fix URL 2020-07-13 17:54:12 -07:00
Kevin Hester
637960edde Merge pull request #277 from geeksville/master
fix doc typo
2020-07-13 17:51:46 -07:00
geeksville
be7e4fea6a Merge branch 'master' into post1 2020-07-13 17:49:54 -07:00
geeksville
d9209ffaea fix doc typo 2020-07-13 17:47:22 -07:00
Kevin Hester
9fb94796c8 Merge pull request #276 from rezl/master
Added Beginner's Guide to README.md
2020-07-13 17:46:02 -07:00
Rezl
f060f7faad Merge pull request #1 from rezl/rezl-beginners-guide
Added Beginner's Guide
2020-07-13 19:35:09 -05:00
Rezl
55673fcd66 Added Beginner's Guide 2020-07-13 19:34:14 -05:00
geeksville
2ff94cb11d Update device protocol docs 2020-07-13 14:41:04 -07:00
geeksville
e46bebc06f rename docs 2020-07-13 14:21:28 -07:00
geeksville
80e8b4adcc turn off gps debug output for now RAK815 2020-07-13 14:20:49 -07:00
Kevin Hester
e9be03b76c Merge pull request #275 from geeksville/post1
NRF52 / RAK815 work items
2020-07-13 14:14:40 -07:00
geeksville
98dfecdb79 Add external RF switch management for RF95 (needed for RAK815) 2020-07-13 13:18:32 -07:00
geeksville
8ba8278fb5 Merge remote-tracking branch 'root/master' into post1 2020-07-13 12:02:14 -07:00
Kevin Hester
51267379ab Merge pull request #273 from geeksville/dev
0.7.11
2020-07-12 15:28:16 -07:00
geeksville
e2cf2ba4f2 recommend tbeam 1.0 over 0.7 2020-07-12 14:55:50 -07:00
geeksville
4550cce639 0.7.11 2020-07-12 14:42:21 -07:00
geeksville
f2f17c81d4 Merge branch 'dev' into post1 2020-07-11 17:17:27 -07:00
Kevin Hester
7c0d13f00a Merge pull request #268 from geeksville/dev
Dev
2020-07-11 17:16:48 -07:00
geeksville
f78f3232e2 update todo 2020-07-11 17:08:36 -07:00
geeksville
a687aa8e75 update nrf52 todo 2020-07-11 17:08:03 -07:00
geeksville
ed6b89b3b1 RAK-815 GPS now kinda works (must update associated libs). comms to it
still a bit yucky
2020-07-10 20:34:03 -07:00
geeksville
9d3ca0d0f9 fix esp32 build 2020-07-10 18:46:33 -07:00
geeksville
05a0405709 GPS not yet ready RAK815 WIP 2020-07-10 14:57:33 -07:00
geeksville
efd8b70089 RAK815 GPS WIP 2020-07-10 14:54:32 -07:00
geeksville
e12c057c31 RAK815 lora works 2020-07-10 14:37:01 -07:00
geeksville
0b5b18653a Panic if new ever returns NULL 2020-07-10 13:52:54 -07:00
geeksville
dc54e7331f memory is tight on the nrf52832 board (for now) - so don't allocate too much 2020-07-10 13:52:26 -07:00
geeksville
6fbf6b2986 RAK815 WIP - use 115200 for serial to USB on this board, best it can do 2020-07-10 13:24:00 -07:00
geeksville
feb9992d7d on rak815 use serial port for console 2020-07-10 13:11:29 -07:00
geeksville
fb4ac82d45 fix rf95 renaming 2020-07-10 12:47:10 -07:00
geeksville
acbe8c159b move rak815 variant to arduino repo 2020-07-10 12:38:11 -07:00
geeksville
63474dd952 Only try for NEMA if we have serial 2020-07-10 12:16:10 -07:00
geeksville
cc35ed7782 update build instructions for RAK815 2020-07-10 12:12:03 -07:00
geeksville
d9fd227862 have CI build RAK815 2020-07-10 11:44:46 -07:00
geeksville
1415f2bed7 WIP add support for i2C GPS 2020-07-10 11:43:14 -07:00
geeksville
5b07d454b1 WIP RAK815 now builds correctly 2020-07-10 11:29:32 -07:00
geeksville
0c04ba4776 use my fixed nrf52832 support in arduino 2020-07-10 11:28:18 -07:00
geeksville
b00a936f41 WIP RAK815 support 2020-07-10 11:02:29 -07:00
geeksville
5b11c1ca86 Merge branch 'dev' into post1 2020-07-10 10:03:18 -07:00
geeksville
7802d00031 add nrf52832 support 2020-07-10 10:03:08 -07:00
geeksville
40a15248e8 @slavino fixed tbeam in #243, so add it back to the builds 2020-07-09 22:43:04 -07:00
geeksville
9ba9e82706 try to fix adafruit-nrfutil bin being in path? 2020-07-09 21:49:07 -07:00
geeksville
ea6c33f3d2 add adafruit-nrfutil to CI build 2020-07-09 21:37:45 -07:00
geeksville
82e5e1858a build for 2 ESP32 targets and 2 NRF52 targets in the CI build 2020-07-09 21:30:52 -07:00
geeksville
80b14c0a6f add support for adafruit feather nrf52832 - which is close to a RAK815 2020-07-09 21:27:34 -07:00
geeksville
6954d0d5f4 Checkout submodules for CI build 2020-07-09 20:31:16 -07:00
geeksville
7e53731fe6 Use our custom variants files and fixes 2020-07-09 20:22:40 -07:00
geeksville
c7290e6ccc don't turn wifi on yet, because my fixes for arduino-esp32 haven't been pushed 2020-07-09 20:11:33 -07:00
geeksville
284317cb25 add nrf52 to CI builds 2020-07-09 20:08:36 -07:00
geeksville
311d1a56b4 make a bare nrf52840dk build which will work for everyone 2020-07-09 20:05:39 -07:00
geeksville
ed589727d6 Update NRF52 build to work again 2020-07-09 19:57:55 -07:00
geeksville
62c9bad183 WIP TCP API server over wifi 2020-07-07 18:37:42 -07:00
geeksville
616da8228e enable wifi for ESP32 2020-07-07 17:41:35 -07:00
geeksville
3a62453b8b todo updates for 1.0 2020-07-07 17:40:59 -07:00
Kevin Hester
c3f7829255 Merge pull request #262 from grcasanova/graphics
Graphics
2020-07-07 15:08:24 -07:00
grcasanova
37d9fb2dad just a cleanup of the graphics 2020-07-07 10:46:49 +02:00
Kevin Hester
4388e72dec Merge pull request #259 from grcasanova/concurrency
Threading refactored
2020-07-06 14:15:18 -07:00
grcasanova
9803141fe7 merged with master 2020-07-06 21:53:10 +02:00
Kevin Hester
1f0e9cc1c3 Merge pull request #258 from Professr/issue#257
Added sinceLastSeen check to pings generated by node UI
2020-07-06 09:20:41 -07:00
grcasanova
92b30ebec6 fixes now compiles 2020-07-06 10:45:55 +02:00
Professr
ccadb6a43d Added sinceLastSeen check to pings generated by node UI 2020-07-05 19:56:57 -07:00
Ellie Hussey
6f7f540c79 Added the option for forced NodeStatus updates on user change or text message, tweaked compass (#256) 2020-07-05 17:03:12 -07:00
grcasanova
d5b8038457 fixes 2020-07-06 00:54:30 +02:00
grcasanova
0a6059ba13 refactored threading-related classes, code broken 2020-07-05 23:11:40 +02:00
Kevin Hester
aba5b01fa0 Merge pull request #255 from geeksville/dev
fix #254 - a RadioLib (and arduino-esp32) needed to have IRAM attr on for disable interrupt
2020-07-05 12:13:08 -07:00
geeksville
09f4943869 Merge remote-tracking branch 'root/master' into dev 2020-07-05 12:10:25 -07:00
Kevin Hester
29c8543f87 Merge pull request #248 from Professr/issue#199
Issue#199 update - add satellite info, change DOP display, add compass rose
2020-07-05 12:10:03 -07:00
geeksville
7bd4940ed8 fix #254 2020-07-05 12:04:15 -07:00
Kevin Hester
d5116935b5 Merge branch 'master' into issue#199 2020-07-04 12:13:21 -07:00
Kevin Hester
0d320fe29b Merge pull request #251 from mrvdb/sh1106-support
Screen width correction for sh1106 display controller
2020-07-04 12:13:04 -07:00
Marcel van der Boom
4159461a62 Merge remote-tracking branch 'upstream/master' into sh1106-support 2020-07-04 10:45:13 +02:00
Ellie Hussey
f4bd39e3fa Merge pull request #246 from slavino/patch-4
Update platformio.ini
2020-07-03 03:27:41 -07:00
Ellie Hussey
fbc36a2cfd Merge branch 'master' into patch-4 2020-07-03 03:25:09 -07:00
Ellie Hussey
e93ba73adb Merge pull request #245 from slavino/patch-3
Update configuration.h
2020-07-03 03:24:56 -07:00
Ellie Hussey
03301f093d Merge branch 'master' into patch-3 2020-07-03 03:22:45 -07:00
Ellie Hussey
55a5fa6fb5 Merge pull request #247 from slavino/patch-5
Update README.md
2020-07-03 03:22:04 -07:00
Professr
4d04d10135 Merge screen.cpp 2020-07-03 02:58:55 -07:00
Professr
cda423acab Changed GPS DOP display to bars, added satellites display and compass rose 2020-07-03 02:53:56 -07:00
Slavomir Hustaty
0f92678c3b Update README.md
TBeam 0.7 + W.W. LoRa freqs list link
2020-07-03 10:35:42 +02:00
Slavomir Hustaty
8d122f36e3 Update platformio.ini
https://github.com/meshtastic/Meshtastic-device/issues/243#issuecomment-653361142
2020-07-03 07:44:14 +02:00
Slavomir Hustaty
439cdfbb32 Update configuration.h
https://github.com/meshtastic/Meshtastic-device/issues/243#issuecomment-653361142
2020-07-03 07:41:22 +02:00
Kevin Hester
0a6ab31e10 Merge pull request #244 from slavino/patch-2
Update configuration.h to fix TBEAM v07 GPS to work
2020-07-02 10:03:07 -07:00
Marcel van der Boom
0b6486256d Merge remote-tracking branch 'upstream/master' into sh1106-support 2020-07-02 17:36:31 +02:00
Slavomir Hustaty
da12b93f82 Update configuration.h
https://user-images.githubusercontent.com/1584034/86362734-08525e00-bc76-11ea-8a34-8579d1fa2965.jpg

related to issue https://github.com/meshtastic/Meshtastic-device/issues/243
2020-07-02 16:54:24 +02:00
Kevin Hester
6dec6af5dc Merge pull request #240 from tobymurray/master
Add Canada to list of countries that use 915 MHz
2020-07-01 11:59:04 -07:00
Kevin Hester
11444621ae Merge branch 'master' into master 2020-07-01 10:26:31 -07:00
Kevin Hester
98f1b3296c Merge pull request #241 from geeksville/dev
Dev
2020-07-01 10:26:13 -07:00
geeksville
26c43e7091 minor docs 2020-07-01 10:22:17 -07:00
Toby Murray
9b9447858a Add Canada to list of countries that use 915 MHz
Meshtastic prompted me to get a couple boards to try, and I had to figure out what frequency. Canada uses the same US902-928 as the US, add it to the list for simplicity.

Not sure where to find an "official" reference, but there's a reference here: https://www.thethingsnetwork.org/docs/lorawan/frequencies-by-country.html
2020-07-01 13:12:00 -04:00
geeksville
3151cfb064 0.7.10 2020-07-01 10:09:32 -07:00
geeksville
c327fee986 Fix formatting 2020-07-01 10:09:06 -07:00
geeksville
a4f53270e8 fix heltec build (and fix formatting) 2020-07-01 10:08:38 -07:00
geeksville
a7456a1126 all targets are arduino - for now 2020-07-01 10:08:09 -07:00
geeksville
8381512ce4 todo updates 2020-07-01 09:32:01 -07:00
Marcel van der Boom
57d968cdcd Merge remote-tracking branch 'upstream/master' into sh1106-support 2020-06-29 09:26:25 +02:00
Kevin Hester
20a669029b Merge pull request #237 from Professr/issue#182
Switch main display to event-driven model, abstract the three main status info categories, work on power.h
2020-06-28 19:10:42 -07:00
Professr
f2e6c6de58 Fixed filename case sensitivity 2020-06-28 19:03:39 -07:00
Professr
8fa44c3590 Disabled the display heartbeat pixel for pull request 2020-06-28 18:55:51 -07:00
Professr
f5b7c33d4e Refactored status handlers and merged 2020-06-28 18:17:52 -07:00
Kevin Hester
be8e663d39 Merge pull request #236 from geeksville/dev
turn on thread watchdog
2020-06-28 11:24:03 -07:00
geeksville
0d4a9748e3 Merge remote-tracking branch 'root/master' into dev 2020-06-28 11:13:05 -07:00
geeksville
bd477f0fb2 turn on thread watchdog 2020-06-28 11:12:12 -07:00
Professr
5317895a5e Merged 2020-06-27 21:26:57 -07:00
Professr
542b8b26ce Abstracted statuses, made display event-driven 2020-06-27 21:19:49 -07:00
Marcel van der Boom
aaca854620 Merge remote-tracking branch 'upstream/master' into sh1106-support 2020-06-27 10:18:55 +02:00
Kevin Hester
64da384fc1 Merge pull request #234 from geeksville/dev
Dev
2020-06-26 16:16:54 -07:00
geeksville
a595fc4642 Fix #233 - init distance string before drawing it
(and violating my own "no formatting checkins with other changes" rule
to restore proper indentation for this file)
2020-06-26 15:04:22 -07:00
geeksville
ac135be8cd move geeksville's personal todos somewhere else (mostly android) 2020-06-25 15:49:49 -07:00
Marcel van der Boom
ac2d3e2ae0 Correct type of setBrightness parameter 2020-06-25 21:16:35 +02:00
Marcel van der Boom
33946af39f SCREEN_WIDTH is visible area already, not addressable area
- sh1106 starts showing from column 2 (the library handles the offsets) so we don't actually need
the different screen width here.
2020-06-25 21:15:12 +02:00
Kevin Hester
5ea59a1c4d Merge pull request #230 from aHVzY2g/pr/228
fix pr #228 int float casting & made fillRect 2px smaller
2020-06-25 11:41:40 -07:00
Kevin Hester
8bafd87b76 Merge branch 'master' into pr/228 2020-06-25 11:26:37 -07:00
Kevin Hester
6b40e9a5e0 Merge pull request #232 from geeksville/dev
Add optional external GPS for TTGO Lora V2
2020-06-25 11:25:46 -07:00
Kevin Hester
a2f6fd9298 Merge branch 'master' into dev 2020-06-25 10:07:06 -07:00
Marlon Spangenberg
bc604fc9ba Merge branch 'master' into pr/228 2020-06-25 18:56:20 +02:00
geeksville
9baaa13897 Add optional external GPS for TTGO Lora V2
per this request: https://meshtastic.discourse.group/t/gps-pin-assignments-for-custom-boards/501/9?u=geeksville
2020-06-25 09:45:21 -07:00
Kevin Hester
65e53be8b0 Merge pull request #231 from geeksville/dev
Add an initial pull-request template
2020-06-25 09:37:40 -07:00
geeksville
7f5283e95d Add an initial pull-request template 2020-06-25 09:33:29 -07:00
Marlon Spangenberg
ae4ab48ddc fixed int float casting & made fillRect 2px smaller 2020-06-25 18:26:32 +02:00
Kevin Hester
afccf1da02 Merge pull request #229 from meshtastic/geeksville-patch-1
Update issue templates
2020-06-25 09:21:38 -07:00
Kevin Hester
fc07c7c01f Update issue templates 2020-06-25 09:18:54 -07:00
Kevin Hester
aeb906414f Merge pull request #228 from mrvdb/sh1106-support
Take configured SCREEN_WIDTH into account for brightness bar
2020-06-25 08:44:34 -07:00
Marcel van der Boom
a6c6b45576 Take different screen widths into account for brightness bar
width of sh1106 display is 132 for example
2020-06-25 16:20:49 +02:00
Kevin Hester
13806cce93 Merge pull request #221 from geeksville/dev
Dev
2020-06-24 16:18:44 -07:00
geeksville
e7eee0995a fix line endings 2020-06-24 16:14:38 -07:00
geeksville
5687bd09c6 Merge remote-tracking branch 'root/master' into dev 2020-06-24 14:08:36 -07:00
Kevin Hester
f3db895832 Merge pull request #222 from aHVzY2g/master
Fix #207 adjust OLED Brightness by attachDuringLongPress
2020-06-24 14:07:52 -07:00
Kevin Hester
dd2ffe5d14 Merge branch 'master' into master 2020-06-24 14:03:56 -07:00
Professr
ec10e784e1 Fix #207 adjust OLED Brightness by attachDuringLongPress
adjust the OLED Brightness by "attachDuringLongPress" from "OneButton". It will cycle trough 0 to 254 as long as the button is pressed
2020-06-24 22:58:20 +02:00
geeksville
649faa1d93 Merge remote-tracking branch 'root/master' into dev 2020-06-24 13:56:48 -07:00
Kevin Hester
669f96b367 Merge pull request #223 from geeksville/whiteheadfix
Fix #150 by @zjwhitehead
2020-06-24 13:46:39 -07:00
geeksville
996821d18e Merge remote-tracking branch 'root/master' 2020-06-24 13:33:16 -07:00
geeksville
2e172b019e Undo @zjwhitehead changes to platformio.ini 2020-06-24 13:29:56 -07:00
Zach Whitehead
3df05cd5c1 break out compass display
Show question mark if unknown location
2020-06-24 13:27:02 -07:00
geeksville
8bb85cdc69 personal TODO list updates (sorry github reviewers) 2020-06-24 13:13:20 -07:00
geeksville
9f6e23754c Add a no_save development flag to allow using settings that
we don't want to save to flash.  Use that flag to guard BLE
stress testing code that makes device repeatedly sleep wake
to force numerous BLE resets
2020-06-24 13:10:36 -07:00
geeksville
5a7cfdffb3 Add links to the preinstalled version of the TBEAMs 2020-06-24 12:49:31 -07:00
Kevin Hester
caafddfdfa Merge pull request #219 from Professr/issue#154
Fixed #154 - Cleaned up UTF-8 conversion, tweaked screen.cpp to replace a hardcoded constant
2020-06-24 08:22:29 -07:00
Kevin Hester
ee0e31be97 Merge branch 'master' into issue#154 2020-06-24 08:19:03 -07:00
Kevin Hester
f1da6469a3 Merge pull request #220 from aHVzY2g/patch-1
added ttgo-lora32-v1 gps pins again :D
2020-06-24 08:18:47 -07:00
Marlon Spangenberg
68e57dd3a7 added ttgo-lora32-v1 gps pins again :D
Sry I messed up as I closed #213, so here are the pin definitions again.
2020-06-24 12:15:50 +02:00
Ellie Hussey
2504311671 Merge branch 'master' into issue#154 2020-06-23 18:30:09 -07:00
Ellie Hussey
aa29315624 Merge pull request #218 from aHVzY2g/patch-2
added Bluetooth Name to paring screen
2020-06-23 18:28:18 -07:00
Professr
e3bcb87cf0 Removed prefix chars, fixed issues related to custom font mappings 2020-06-23 18:02:41 -07:00
Professr
2530dc44c7 Changed unconvertable-character symbol to ¿ and made it return only one per unconvertable sequence 2020-06-23 16:46:41 -07:00
Professr
70a8fe30b7 Merge https://github.com/meshtastic/Meshtastic-device into issue#154 2020-06-23 16:45:40 -07:00
Marlon Spangenberg
30e538e5ed added Bluetooth Name to paring screen
& changed the order
2020-06-24 01:08:23 +02:00
Kevin Hester
58dbc3c702 Merge pull request #216 from Professr/issue#162
Use spare TBeam GPIO for an alternate middle button - Issue#162
2020-06-23 15:42:19 -07:00
Kevin Hester
210c904604 Merge branch 'master' into issue#162 2020-06-23 15:40:02 -07:00
Kevin Hester
27fdab7c8d Merge pull request #214 from geeksville/dev
Dev
2020-06-23 15:39:28 -07:00
Kevin Hester
ba3e1abb5e Merge branch 'master' into dev 2020-06-23 15:37:07 -07:00
Kevin Hester
ce194e2162 Merge pull request #212 from Professr/issue#197
Add cpp clamp function to utils.h, converted signal strength to %
2020-06-23 15:36:53 -07:00
Kevin Hester
595166db8e Merge branch 'master' into dev 2020-06-23 15:35:55 -07:00
Kevin Hester
38d9e34a66 Merge branch 'master' into issue#197 2020-06-23 15:34:15 -07:00
Kevin Hester
c1e0977db3 Merge branch 'master' into issue#162 2020-06-23 15:28:54 -07:00
Kevin Hester
b4f32e7645 thank you @rorosaurus!
update README per issue #189
2020-06-23 15:26:40 -07:00
Rory Hayes
6bb0c95c95 update README per issue #189 2020-06-23 14:28:38 -07:00
geeksville
4e958c9230 make software update keep device from sleeping 2020-06-22 17:10:41 -07:00
geeksville
64cf1890f2 prebump to 0.7.9 build number, though not doing a release yet...
Because I want to pick a min build number for 'BLE OTA update allowed'
2020-06-22 17:10:18 -07:00
Professr
6a857b00db Add cpp clamp function to util.h, switched battery and signal strength percentage calcs to it #197 2020-06-22 14:06:02 -07:00
Professr
6d60a061bc Merge https://github.com/meshtastic/Meshtastic-device into issue#154 2020-06-22 12:27:44 -07:00
Professr
6a09ddef18 Resolved merge conflict 2020-06-22 12:25:59 -07:00
Professr
d48e803b7b Custom utf8 conversion replaces unconvertable chars with ? instead of blanks, #154 2020-06-22 12:03:26 -07:00
Kevin Hester
9061b3d8c3 Merge pull request #206 from geeksville/dev
Dev
2020-06-22 11:39:13 -07:00
geeksville
2839539c6c todo for my personal work queue 2020-06-22 11:36:48 -07:00
geeksville
f77a1798f3 Merge remote-tracking branch 'root/master' into dev 2020-06-22 11:36:06 -07:00
Kevin Hester
664b558a36 Merge pull request #210 from aHVzY2g/patch-1
Just a link to a need little case for the TTGO LORA32 v1
2020-06-22 11:26:18 -07:00
geeksville
c1865f127c make sure people who are not just me, get the fixed arduino-esp32 2020-06-22 11:17:08 -07:00
Marlon Spangenberg
3a69539192 Just a link to a need little case for the TTGO LORA32 v1 2020-06-22 20:15:19 +02:00
Professr
cfcaf28ace Switched user button to OneButton, added alt button GPIO for #162 2020-06-22 11:09:26 -07:00
geeksville
d9e93f3944 Try turning my software update service back on...
Now that I've fixed a couple of nasty esp32-arduino bugs
2020-06-22 10:06:35 -07:00
geeksville
60470211e5 expose battery level via the standard BLE battery service 2020-06-22 10:04:26 -07:00
geeksville
c5851a4a0c Report battery level to other nodes in mesh (and apps).
Also today I'll turn back on the the standard "has a battery" BLE
device profile, so the locally connected radio should show up in the
phone's bluetooth popup of battery levels (similar to how a BLE
headphone battery level appears)

cc @lgoix - using code from @professr

```
meshtastic --info
Connected to radio...
my_node_num: 2883444536
has_gps: true
num_channels: 13
region: "unset"
hw_model: "tbeam"
firmware_version: "unset"
packet_id_bits: 32
current_packet_id: 91018534
node_num_bits: 32
message_timeout_msec: 300000
min_app_version: 172

preferences {
  position_broadcast_secs: 900
  send_owner_interval: 4
  wait_bluetooth_secs: 120
  screen_on_secs: 300
  phone_timeout_secs: 900
  phone_sds_timeout_sec: 7200
  mesh_sds_timeout_secs: 7200
  sds_secs: 31536000
  ls_secs: 3600
}
channel_settings {
  tx_power: 23
  modem_config: Bw125Cr48Sf4096
  psk: "\324\361\273: )\007Y\360\274\377\253\317Ni\277"
  name: "Default"
}

Nodes in mesh:
{'num': 2883444536, 'user': {'id': '!2462abdddf38', 'longName': 'Unknown df38', 'shortName': '?38', 'macaddr': 'JGKr3d84'}, 'position': {'altitude': 96, 'batteryLevel': 100, 'latitudeI': 375210641, 'longitudeI': -1223090398, 'time': 1592843564, 'latitude': 37.5210641, 'longitude': -122.3090398}}
```
2020-06-22 09:36:19 -07:00
geeksville
0c0b2446b7 Merge remote-tracking branch 'root/master' into dev 2020-06-22 09:22:54 -07:00
Kevin Hester
ce9352fd23 Merge pull request #209 from Professr/issue#134
Converted status text to graphical header, Issue#134
2020-06-22 09:22:37 -07:00
Kevin Hester
375ae5fe77 Merge pull request #208 from Professr/issue#196
Added battery charge percentage support, Issue#196
2020-06-22 09:19:10 -07:00
geeksville
665d35196d never wait on GPS reads 2020-06-22 09:17:15 -07:00
geeksville
9757f9ae53 geeksville personal todo list 2020-06-22 09:17:04 -07:00
Professr
e45d0c4dcf Offset battery bars by 1 to reflect room between BAT_MILLIVOLTS_EMPTY and MIN_BAT_MILLIVOLTS 2020-06-22 00:10:04 -07:00
Professr
5c9f22bc18 Moved node count graphic slightly to the left, to allow room for triple-digit node counts 2020-06-21 19:44:32 -07:00
Professr
d8287e9cdb Removed DOP to string utility function from GPS.cpp since it's now drawn directly in screen.cpp 2020-06-21 17:43:34 -07:00
Professr
c66e064f42 Replaced battery, node, and gps text with a graphical header. Added hash to the beginning of the channel name. 2020-06-21 17:28:37 -07:00
Professr
364fc84aaa Removed unnecessary include, ready for consideration for issue #196 2020-06-21 16:31:09 -07:00
Professr
fe4f86bc84 Added battery charge percent estimation 2020-06-21 16:21:34 -07:00
geeksville
982b2e33ff Merge remote-tracking branch 'root/master' into dev 2020-06-21 14:11:53 -07:00
geeksville
8190098bb8 experiment with wifi connections for nodes 2020-06-21 14:11:38 -07:00
Kevin Hester
c99411311b Merge pull request #204 from Professr/issue#199
@professr Added GPS DOP support (#199)
2020-06-21 14:05:05 -07:00
Professr
da8a048dce Added GPS DOP support (#199) 2020-06-20 18:59:41 -07:00
geeksville
b4de495154 show app version on boot screen 2020-06-20 17:07:17 -07:00
Kevin Hester
aaa6af3f38 Merge pull request #202 from geeksville/dev
0.7.8 - build with new fixed arduino-esp32 lib
2020-06-20 14:58:19 -07:00
geeksville
b11b322581 0.7.8 2020-06-20 14:53:25 -07:00
geeksville
60b38215ce fix docs per @feh123 2020-06-20 09:58:45 -07:00
geeksville
53e68515dd Merge remote-tracking branch 'root/master' into dev 2020-06-19 13:57:21 -07:00
geeksville
7676ae9184 typo 2020-06-19 13:57:10 -07:00
Kevin Hester
b385feefa5 Merge pull request #201 from geeksville/dev
Fix crypto doc links
2020-06-19 13:50:19 -07:00
Kevin Hester
fc50b4abc0 Merge branch 'master' into dev 2020-06-19 13:47:52 -07:00
geeksville
0104a2eb3a Fix crypto doc links 2020-06-19 13:47:00 -07:00
Kevin Hester
23fdc9d1a9 Merge pull request #195 from geeksville/dev
Dev
2020-06-19 13:30:53 -07:00
geeksville
ea4a678308 Add reviewer comments on crypto 2020-06-19 13:27:31 -07:00
geeksville
6566c4f15e don't send bogus latitudes 2020-06-18 14:09:13 -07:00
geeksville
6f39f1740f add pinetab work queue 2020-06-18 11:57:29 -07:00
geeksville
7b61bdbfd2 Merge remote-tracking branch 'root/master' into dev 2020-06-18 11:50:44 -07:00
geeksville
8e65db19b0 Add notes on linux drivers & pins for pinetab #143 2020-06-18 11:50:04 -07:00
Kevin Hester
698fcdad36 Merge pull request #194 from geeksville/dev
Fix #187, Ublox GPS fixes, see below:
2020-06-18 11:25:45 -07:00
geeksville
c25d6e974f sometimes first read might return 0 for EITHER lat or lon 2020-06-18 11:22:38 -07:00
geeksville
35aae48932 0.7.7 2020-06-18 11:18:53 -07:00
geeksville
f8afa2703f Merge remote-tracking branch 'root/master' into dev 2020-06-18 11:18:15 -07:00
geeksville
cd903dceb9 Fix #187, Ublox GPS fixes, see below:
This was a good one. Two problems
1) We've apparently always been using hte sparkfun API the wrong way, but
but we mostly got lucky.
2) Changing to use the API correctly (asyncronously) exposed a bug in
the library - fixed in a seperate commit
2020-06-18 11:17:01 -07:00
Kevin Hester
5843c6f25e Merge pull request #193 from geeksville/dev
misc fixes
2020-06-17 19:29:14 -07:00
geeksville
3005373760 fix wording of GPS screen messages to be less confusing. Now:
No GPS
No Sats
GPS OK
2020-06-17 17:26:37 -07:00
geeksville
7678540a93 For #187 was not reporting GPS status on new API 2020-06-17 17:25:55 -07:00
geeksville
463666aec5 oops - can't call DEBUG_MSG this early on ESP32 2020-06-17 16:04:37 -07:00
geeksville
5847f94ece Merge remote-tracking branch 'mine/dev' into dev 2020-06-17 15:48:04 -07:00
geeksville
09855b76ef TODO updates 2020-06-17 15:45:49 -07:00
Kevin Hester
f4d476d160 Merge pull request #191 from geeksville/dev
merge cubecell/memory experiments
2020-06-17 11:41:31 -07:00
Kevin Hester
d88d4be63e Merge branch 'master' into dev 2020-06-17 11:39:23 -07:00
geeksville
154114e900 merge cubecell experiments back into master (might delete later) 2020-06-17 11:35:21 -07:00
geeksville
03f019dea2 memory size debugging 2020-06-16 19:55:14 -07:00
geeksville
a47524b762 cubecell wip 2020-06-16 17:13:26 -07:00
geeksville
fd2f5a5ba4 Merge branch 'dev' into cubecell 2020-06-16 16:18:30 -07:00
geeksville
e66b2234f6 Experiment with small ram NRF52s 2020-06-16 15:27:08 -07:00
geeksville
f35b15b09c Shrink devicestate for small mcus 2020-06-16 15:26:30 -07:00
geeksville
99dac51b9d Don't use a (huge - 16KB) scratch buffer for device state loading 2020-06-16 15:02:11 -07:00
geeksville
656faf4ce9 ram investigation notes 2020-06-16 15:01:39 -07:00
geeksville
d9ab6986ad per @dafeman 1.8V works on E22 2020-06-16 12:02:13 -07:00
geeksville
514d45c219 oops supposed to be TXEN 2020-06-16 06:38:08 -07:00
Kevin Hester
94b7fc76c1 Merge pull request #188 from geeksville/ppr
sx1262 for dafeman
2020-06-16 06:30:15 -07:00
geeksville
e9923ac257 fix LCD build for devboard 2020-06-16 06:26:34 -07:00
geeksville
60ad1793e4 sx1262 improvements attn @dafeman 2020-06-16 06:26:21 -07:00
geeksville
96a15bec3b doc updates 2020-06-16 06:25:54 -07:00
Dafeman
91b4cadb1b Merge pull request #4 from meshtastic/master
Update
2020-06-16 14:41:27 +12:00
Kevin Hester
fba676fc07 Merge pull request #185 from geeksville/bringup
nrf52 backmerge into master
2020-06-15 14:53:11 -07:00
geeksville
9ad14ad98b Cleanup to merge NR52 support back into mainline 2020-06-15 14:47:14 -07:00
geeksville
477c62082d E22 SX1262 module now works!
Thanks mostly to an old github comment by @beegee-tokyo the fix was easy
(comment here https://github.com/jgromes/RadioLib/issues/12#issuecomment-520450429)

We now set DIO3 to 2.4 volts to power the oscillator inside the E22
module (undocumented in the E22 docs)
2020-06-15 14:38:09 -07:00
geeksville
82169d4115 make recent changes work on non ESP hardware 2020-06-15 13:32:06 -07:00
geeksville
362d5452d5 remove unused chip 2020-06-15 13:31:53 -07:00
geeksville
92e5a15399 Merge branch 'master' into cubecell 2020-06-15 12:42:01 -07:00
geeksville
114e0c4ada Merge branch 'master' into bringup 2020-06-15 12:41:22 -07:00
Kevin Hester
075ff26499 @mrvdb added support for SH1106 displays!
Add support for SH1106 controller
2020-06-15 12:29:59 -07:00
Kevin Hester
d65f2ede81 Merge branch 'master' into sh1106-support 2020-06-15 12:26:12 -07:00
Kevin Hester
4a9248a451 @zombodotcom added support for optional external GPS on heltec lora v2!
Fixed GPS pin Definitions for Heltec Lora V2
2020-06-15 12:25:56 -07:00
Zombodotcom
1c6092c430 Fixed GPS pin Definitions 2020-06-15 11:38:15 -06:00
Kevin Hester
0e9ed1e82f Merge pull request #183 from geeksville/dev
Dev
2020-06-15 07:19:45 -07:00
geeksville
02ce0558b9 Merge remote-tracking branch 'root/master' into dev 2020-06-15 07:13:34 -07:00
geeksville
63110f0134 Merge remote-tracking branch 'mine/dev' into dev 2020-06-15 07:12:31 -07:00
geeksville
d8db4449be 0.7.6 2020-06-15 07:04:03 -07:00
geeksville
fda98bbf58 oops BLE auth should not change 2020-06-14 15:52:06 -07:00
geeksville
aadba1f694 add printPacket for debug printing packets 2020-06-14 15:30:42 -07:00
geeksville
2c8d152885 Use old style (pre BLE 4.2) pairing, it seems more reliable 2020-06-14 15:30:21 -07:00
BeardyWalrus
0b1a78c028 Merge pull request #2 from meshtastic/master
Pull to live
2020-06-14 16:06:06 -04:00
Marcel van der Boom
37c598833c Add support for SH1106 controller
The SH1106 is almost indistinguisable from a SSD1306.

- the nr of columns in the sh1106 is 132 vs 128
- use the proper includes/library functions when in use
2020-06-14 10:28:23 +02:00
geeksville
e382a181f7 Merge remote-tracking branch 'root/master' into dev 2020-06-13 16:50:01 -07:00
geeksville
f02a2c0853 Merge branch 'usb' into bringup 2020-06-09 18:20:34 -07:00
geeksville
71a4cfefd5 bringup WIP 2020-06-08 15:01:55 -07:00
geeksville
1c63a70673 cubecell WIP 2020-06-05 17:30:09 -07:00
geeksville
8022f3b920 Merge branch 'master' into bringup 2020-06-05 16:02:54 -07:00
geeksville
4db176867b WIP - bringup on PPR 2020-06-05 11:00:58 -07:00
BeardyWalrus
b8e1b28958 Merge pull request #1 from meshtastic/master
Resync with Upstream
2020-05-21 20:36:06 -04:00
Dafeman
a23f327461 Merge pull request #3 from Dafeman/README-GUI-update
Update GUI Install
2020-05-19 13:50:30 +12:00
272 changed files with 70449 additions and 4458 deletions

View File

@@ -0,0 +1,38 @@
---
name: Bug report or feature proposal
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
Please - if you just have a question (i.e. not a bug report or a feature proposal), post in our [forum](https://meshtastic.discourse.group/) instead.
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Device info:**
- Device model: [e.g. TBEAM]
- Software Version [e.g. 0.7.8]
**Smartphone information (if relevant):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- App Version [e.g. 0.7.2]
**Additional context**
Add any other context about the problem here.

13
.github/pull_request_template.md vendored Normal file
View File

@@ -0,0 +1,13 @@
## Thank you for sending in a pull request, here's some tips to get started!
(Please delete all these tips and replace with your text)
- Before starting on some new big chunk of code, it it is optional but highly recommended to open an issue first
to say "hey, I think this idea X should be implemented and I'm starting work on it. My general plan is Y, any feedback
is appreciated." This will allow other devs to potentially save you time by not accidentially duplicating work etc...
- Please do not check in files that don't have real changes
- Please do not reformat lines that you didn't have to change the code on
- We recommend using the [Visual Studio Code](https://platformio.org/install/ide?install=vscode) editor,
because automatically follows our indentation rules and it's auto reformatting will not cause spurious changes to lines.
- If your PR fixes a bug, mention "fixes #bugnum" somewhere in your pull request description.
- If your other co-developers have comments on your PR please tweak as needed.

View File

@@ -9,6 +9,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Checkout submodules
uses: textbook/git-checkout-submodule-action@master
- name: Setup Python
uses: actions/setup-python@master
with:
@@ -17,5 +19,8 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -U platformio
- name: Install extra python tools
run: |
pip install -U adafruit-nrfutil
- name: Build
run: platformio run
run: platformio run -e tbeam -e heltec -e lora-relay-v1 -e linux

13
.gitignore vendored
View File

@@ -7,4 +7,15 @@ main/credentials.h
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/extensions.json
*.code-workspace
*.code-workspace
.DS_Store
Thumbs.db
.autotools
.built
.context
.cproject
.idea/*
.vagrant
nanopb*
flash.uf2

14
.vscode/settings.json vendored
View File

@@ -47,18 +47,26 @@
"memory_resource": "cpp",
"optional": "cpp",
"string_view": "cpp",
"cassert": "cpp"
"cassert": "cpp",
"iterator": "cpp",
"shared_mutex": "cpp",
"iostream": "cpp"
},
"cSpell.words": [
"Blox",
"EINK",
"HFSR",
"Meshtastic",
"NEMAGPS",
"NMEAGPS",
"RDEF",
"Ublox",
"bkpt",
"cfsr",
"descs",
"ocrypto",
"protobufs"
]
"protobufs",
"wifi"
],
"C_Cpp.dimInactiveRegions": true
}

17
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,17 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "PlatformIO",
"task": "Build",
"problemMatcher": [
"$platformio"
],
"group": {
"kind": "build",
"isDefault": true
},
"label": "PlatformIO: Build"
}
]
}

View File

@@ -22,24 +22,35 @@ This software is 100% open source and developed by a group of hobbyist experimen
We currently support three models of radios.
- TTGO T-Beam
- [T-Beam V1.0 w/ NEO-M8N](https://www.aliexpress.com/item/33047631119.html) (Recommended)
- [T-Beam V1.0 w/ NEO-6M](https://www.aliexpress.com/item/33050391850.html)
- TTGO T-Beam (usually the recommended choice)
- [T-Beam V1.1 w/ NEO-6M - special Meshtastic version](https://www.aliexpress.com/item/4001178678568.html) (Includes built-in OLED display and they have **preinstalled** the meshtastic software)
- [T-Beam V1.1 w/ NEO-M8N](https://www.aliexpress.com/item/33047631119.html) (slightly better GPS)
- [T-Beam V1.1 w/ NEO-M8N /w SX1262](https://www.aliexpress.com/item/4001287221970.html) (slightly better GPS + LoRa)
- board labels "TTGO T22_V1.1 20191212"
- [T-Beam V0.7 w/ NEO-6M](https://www.aliexpress.com/item/4000574335430.html) (will work but **you must use the tbeam0.7 firmware ** - but the T-Beam V1.0 or later are better!)
- board labels "TTGO T22_V07 20180711"
- 3D printable cases
- [T-Beam V0](https://www.thingiverse.com/thing:3773717)
- [T-Beam V1](https://www.thingiverse.com/thing:3830711)
- [T-Beam V1 (SMA-antenna)](https://www.thingiverse.com/thing:3830711)
- [T-Beam V1 (IPEX-antenna)](https://www.thingiverse.com/thing:4587297)
- Laser-cut cases
- [T-Beam V1](https://www.thingiverse.com/thing:4552771)
- [TTGO LORA32](https://www.aliexpress.com/item/4000211331316.html) - No GPS
- version 2.1
- board labels "TTGO T3_V1.6 20180606"
- 3D printable case
- [TTGO LORA32 v1](https://www.thingiverse.com/thing:3385109)
- [Heltec LoRa 32](https://heltec.org/project/wifi-lora-32/) - No GPS
- [3D Printable case](https://www.thingiverse.com/thing:3125854)
**Make sure to get the frequency for your country**
- US/JP/AU/NZ - 915MHz
- US/JP/AU/NZ/CA - 915MHz
- CN - 470MHz
- EU - 868MHz, 433MHz
- full list of LoRa frequencies per region is available [here](https://www.thethingsnetwork.org/docs/lorawan/frequencies-by-country.html)
Getting a version that includes a screen is optional, but highly recommended.
@@ -47,6 +58,8 @@ Getting a version that includes a screen is optional, but highly recommended.
Prebuilt binaries for the supported radios are available in our [releases](https://github.com/meshtastic/Meshtastic-esp32/releases). Your initial installation has to happen over USB from your Mac, Windows or Linux PC. Once our software is installed, all future software updates happen over bluetooth from your phone.
Be **very careful** to install the correct load for your board. In particular the popular 'T-BEAM' radio from TTGO is not called 'TTGO-Lora' (that is a different board). So don't install the 'TTGO-Lora' build on a TBEAM, it won't work correctly.
Please post comments on our [group chat](https://meshtastic.discourse.group/) if you have problems or successes.
### Installing from a GUI - Windows and Mac
@@ -90,10 +103,10 @@ Hard resetting via RTS pin...
```
5. cd into the directory where the release zip file was expanded.
6. Install the correct firmware for your board with `device-install.sh firmware-_board_-_country_.bin`.
- Example: `./device-install.sh firmware-HELTEC-US-0.0.3.bin`.
7. To update run `device-update.sh firmware-_board_-_country_.bin`
- Example: `./device-update.sh firmware-HELTEC-US-0.0.3.bin`.
6. Install the correct firmware for your board with `device-install.sh -f firmware-_board_-_country_.bin`.
- Example: `./device-install.sh -f firmware-HELTEC-US-0.0.3.bin`.
7. To update run `device-update.sh -f firmware-_board_-_country_.bin`
- Example: `./device-update.sh -f firmware-HELTEC-US-0.0.3.bin`.
Note: If you have previously installed meshtastic, you don't need to run this full script instead just run `esptool.py --baud 921600 write_flash 0x10000 firmware-_board_-_country_-_version_.bin`. This will be faster, also all of your current preferences will be preserved.
@@ -168,7 +181,7 @@ Hard resetting via RTS pin...
# Meshtastic Android app
The companion (optional) Meshtastic Android app is [here](https://github.com/meshtastic/Meshtastic-Android). You can also download it on Google Play.
The companion (optional) Meshtastic Android app is [here](https://play.google.com/store/apps/details?id=com.geeksville.mesh&referrer=utm_source%3Dgithub-dev-readme). You can also download it on Google Play.
# Python API

View File

@@ -2,14 +2,17 @@
set -e
source bin/version.sh
VERSION=`bin/buildinfo.py`
COUNTRIES="US EU433 EU865 CN JP"
COUNTRIES="US EU433 EU865 CN JP ANZ KR"
#COUNTRIES=US
#COUNTRIES=CN
BOARDS="ttgo-lora32-v2 ttgo-lora32-v1 tbeam heltec"
#BOARDS=tbeam
BOARDS_ESP32="tlora-v2 tlora-v1 tlora-v2-1-1.6 tbeam heltec tbeam0.7"
#BOARDS_ESP32=tbeam
# FIXME note nrf52840dk build is for some reason only generating a BIN file but not a HEX file nrf52840dk-geeksville is fine
BOARDS_NRF52="lora-relay-v1"
OUTDIR=release/latest
@@ -18,25 +21,61 @@ ARCHIVEDIR=release/archive
rm -f $OUTDIR/firmware*
mkdir -p $OUTDIR/bins $OUTDIR/elfs
rm -f $OUTDIR/bins/*
mkdir -p $OUTDIR/bins
rm -r $OUTDIR/bins/*
mkdir -p $OUTDIR/bins/universal $OUTDIR/elfs/universal
# build the named environment and copy the bins to the release directory
function do_build {
ENV_NAME=$1
echo "Building for $ENV_NAME with $PLATFORMIO_BUILD_FLAGS"
SRCBIN=.pio/build/$ENV_NAME/firmware.bin
SRCELF=.pio/build/$ENV_NAME/firmware.elf
rm -f $SRCBIN
function do_build() {
BOARD=$1
COUNTRY=$2
isNrf=$3
echo "Building $COUNTRY for $BOARD with $PLATFORMIO_BUILD_FLAGS"
rm -f .pio/build/$BOARD/firmware.*
# The shell vars the build tool expects to find
export HW_VERSION="1.0-$COUNTRY"
export APP_VERSION=$VERSION
export COUNTRY
pio run --jobs 4 --environment $ENV_NAME # -v
cp $SRCBIN $OUTDIR/bins/firmware-$ENV_NAME-$COUNTRY-$VERSION.bin
cp $SRCELF $OUTDIR/elfs/firmware-$ENV_NAME-$COUNTRY-$VERSION.elf
# Are we building a universal/regionless rom?
if [ "x$COUNTRY" != "x" ]
then
export HW_VERSION="1.0-$COUNTRY"
export COUNTRY
basename=firmware-$BOARD-$COUNTRY-$VERSION
else
export HW_VERSION="1.0"
unset COUNTRY
basename=universal/firmware-$BOARD-$VERSION
fi
pio run --jobs 4 --environment $BOARD # -v
SRCELF=.pio/build/$BOARD/firmware.elf
cp $SRCELF $OUTDIR/elfs/$basename.elf
if [ "$isNrf" = "false" ]
then
echo "Copying ESP32 bin file"
SRCBIN=.pio/build/$BOARD/firmware.bin
cp $SRCBIN $OUTDIR/bins/$basename.bin
else
echo "Generating NRF52 uf2 file"
SRCHEX=.pio/build/$BOARD/firmware.hex
bin/uf2conv.py $SRCHEX -c -o $OUTDIR/bins/$basename.uf2 -f 0xADA52840
fi
}
function do_boards() {
declare boards=$1
declare isNrf=$2
for board in $boards; do
for country in $COUNTRIES; do
do_build $board $country "$isNrf"
done
# Build universal
do_build $board "" "$isNrf"
done
}
# Make sure our submodules are current
@@ -45,14 +84,20 @@ git submodule update
# Important to pull latest version of libs into all device flavors, otherwise some devices might be stale
platformio lib update
for COUNTRY in $COUNTRIES; do
for BOARD in $BOARDS; do
do_build $BOARD
done
done
do_boards "$BOARDS_ESP32" "false"
do_boards "$BOARDS_NRF52" "true"
echo "Building SPIFFS for ESP32 targets"
pio run --environment tbeam -t buildfs
cp .pio/build/tbeam/spiffs.bin $OUTDIR/bins/universal/spiffs-$VERSION.bin
# keep the bins in archive also
cp $OUTDIR/bins/firmware* $OUTDIR/elfs/firmware* $ARCHIVEDIR
cp $OUTDIR/bins/firmware* $OUTDIR/bins/universal/spiffs* $OUTDIR/elfs/firmware* $OUTDIR/bins/universal/firmware* $OUTDIR/elfs/universal/firmware* $ARCHIVEDIR
echo Updating android bins $OUTDIR/forandroid
rm -rf $OUTDIR/forandroid
mkdir -p $OUTDIR/forandroid
cp -a $OUTDIR/bins/universal/*.bin $OUTDIR/forandroid/
cat >$OUTDIR/curfirmwareversion.xml <<XML
<?xml version="1.0" encoding="utf-8"?>
@@ -66,7 +111,8 @@ Generated by bin/buildall.sh -->
</resources>
XML
echo Generating $ARCHIVEDIR/firmware-$VERSION.zip
rm -f $ARCHIVEDIR/firmware-$VERSION.zip
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $OUTDIR/bins/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh bin/device-update.sh
zip --junk-paths $ARCHIVEDIR/firmware-$VERSION.zip $ARCHIVEDIR/spiffs-$VERSION.bin $OUTDIR/bins/firmware-*-$VERSION.* images/system-info.bin bin/device-install.sh bin/device-update.sh
echo BUILT ALL

11
bin/buildinfo.py Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env python3
import configparser
config = configparser.RawConfigParser()
config.read('version.properties')
version = dict(config.items('VERSION'))
verStr = "{}.{}.{}".format(version["major"], version["minor"], version["build"])
print(f"{verStr}")

View File

@@ -1,11 +1,48 @@
#!/bin/bash
#!/bin/sh
set -e
FILENAME=$1
# Usage info
show_help() {
cat << EOF
Usage: ${0##*/} [-h] [-p ESPTOOL_PORT] [-f FILENAME]
Flash image file to device, but first erasing and writing system information"
echo "Trying to flash $FILENAME, but first erasing and writing system information"
esptool.py --baud 921600 erase_flash
esptool.py --baud 921600 write_flash 0x1000 system-info.bin
esptool.py --baud 921600 write_flash 0x10000 $FILENAME
-h Display this help and exit
-p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous).
-f FILENAME The .bin file to flash. Custom to your device type and region.
EOF
}
while getopts ":h:p:f:" opt; do
case "${opt}" in
h)
show_help
exit 0
;;
p) export ESPTOOL_PORT=${OPTARG}
;;
f) FILENAME=${OPTARG}
;;
*)
echo "Invalid flag."
show_help >&2
exit 1
;;
esac
done
shift "$((OPTIND-1))"
if [ -f "${FILENAME}" ]; then
echo "Trying to flash ${FILENAME}, but first erasing and writing system information"
esptool.py --baud 921600 erase_flash
esptool.py --baud 921600 write_flash 0x1000 system-info.bin
esptool.py --baud 921600 write_flash 0x00390000 spiffs-*.bin
esptool.py --baud 921600 write_flash 0x10000 ${FILENAME}
else
echo "Invalid file: ${FILENAME}"
show_help
fi
exit 0

View File

@@ -1,8 +1,43 @@
#!/bin/bash
#!/bin/sh
set -e
# Usage info
show_help() {
cat << EOF
Usage: ${0##*/} [-h] [-p ESPTOOL_PORT] -f FILENAME
Flash image file to device, leave existing system intact."
FILENAME=$1
-h Display this help and exit
-p ESPTOOL_PORT Set the environment variable for ESPTOOL_PORT. If not set, ESPTOOL iterates all ports (Dangerrous).
-f FILENAME The .bin file to flash. Custom to your device type and region.
EOF
}
echo "Trying to update $FILENAME"
esptool.py --baud 921600 write_flash 0x10000 $FILENAME
while getopts ":h:p:f:" opt; do
case "${opt}" in
h)
show_help
exit 0
;;
p) export ESPTOOL_PORT=${OPTARG}
;;
f) FILENAME=${OPTARG}
;;
*)
echo "Invalid flag."
show_help >&2
exit 1
;;
esac
done
shift "$((OPTIND-1))"
if [ -f "${FILENAME}" ]; then
echo "Trying to flash update ${FILENAME}."
esptool.py --baud 921600 write_flash 0x10000 ${FILENAME}
else
echo "Invalid file: ${FILENAME}"
show_help
fi
exit 0

3
bin/dump-ram-users.sh Executable file
View File

@@ -0,0 +1,3 @@
arm-none-eabi-readelf -s -e .pio/build/nrf52dk/firmware.elf | head -80
nm -CSr --size-sort .pio/build/nrf52dk/firmware.elf | grep '^200'

35
bin/install-bootloader.sh Executable file
View File

@@ -0,0 +1,35 @@
# You probably don't want to use this script, it programs a custom bootloader build onto a nrf52 board
set -e
# dependencies
# apt install srecord
BOOTDIR=/home/kevinh/development/meshtastic/Adafruit_nRF52_Bootloader
BOARD=othernet_ppr1
BOOTVER=0.3.2
BOOTNUM=128
BOOTSHA=gc01b9ea
SDCODE=s113
SDVER=7.2.0
PROJ=ppr1
# FIXME for nRF52840 use 0xff000, for nRF52833 use 0x7f000
BOOTSET=0x7f000
nrfjprog --eraseall -f nrf52
# this generates an intel hex file that can be programmed into a NRF52 to tell the adafruit bootloader that the current app image is valid
# Bootloader settings are at BOOTLOADER_SETTINGS (rw) : ORIGIN = 0xFF000, LENGTH = 0x1000
# first 4 bytes should be 0x01 to indicate valid app image
# second 4 bytes should be 0x00 to indicate no CRC required for image
echo "01 00 00 00 00 00 00 00" | xxd -r -p - >/tmp/bootconf.bin
srec_cat /tmp/bootconf.bin -binary -offset $BOOTSET -output /tmp/bootconf.hex -intel
echo Generating merged hex file from .pio/build/$PROJ/firmware.hex
mergehex -o ${BOARD}_full.hex -m $BOOTDIR/_build/build-$BOARD/${BOARD}_bootloader-$BOOTVER-$BOOTNUM-$BOOTSHA-dirty_${SDCODE}_$SDVER.hex .pio/build/$PROJ/firmware.hex /tmp/bootconf.hex
echo Telling bootloader app region is valid and telling CPU to run
nrfjprog --program ${BOARD}_full.hex -f nrf52 --reset
# nrfjprog --readuicr /tmp/uicr.hex; objdump -s /tmp/uicr.hex | less

22
bin/install-eink.sh Executable file
View File

@@ -0,0 +1,22 @@
# You probably don't want to use this script, it programs a custom bootloader build onto a nrf52 board
set -e
BOOTDIR=/home/kevinh/development/meshtastic/Adafruit_nRF52_Bootloader
nrfjprog --eraseall -f nrf52
# this generates an intel hex file that can be programmed into a NRF52 to tell the adafruit bootloader that the current app image is valid
# Bootloader settings are at BOOTLOADER_SETTINGS (rw) : ORIGIN = 0xFF000, LENGTH = 0x1000
# first 4 bytes should be 0x01 to indicate valid app image
# second 4 bytes should be 0x00 to indicate no CRC required for image
echo "01 00 00 00 00 00 00 00" | xxd -r -p - >/tmp/bootconf.bin
srec_cat /tmp/bootconf.bin -binary -offset 0xff000 -output /tmp/bootconf.hex -intel
echo Generating merged hex file
mergehex -m $BOOTDIR/_build/build-ttgo_eink/ttgo_eink_bootloader-0.3.2-125-gf38f8f4-dirty_s140_6.1.1.hex .pio/build/eink/firmware.hex /tmp/bootconf.hex -o ttgo_eink_full.hex
echo Telling bootloader app region is valid and telling CPU to run
nrfjprog --program ttgo_eink_full.hex -f nrf52 --reset
# nrfjprog --readuicr /tmp/uicr.hex; objdump -s /tmp/uicr.hex | less

3
bin/nrf52832-gdbserver.sh Executable file
View File

@@ -0,0 +1,3 @@
JLinkGDBServerCLExe -if SWD -select USB -port 2331 -device NRF52832_XXAA

3
bin/nrf52833-gdbserver.sh Executable file
View File

@@ -0,0 +1,3 @@
JLinkGDBServerCLExe -if SWD -select USB -port 2331 -device NRF52833_XXAA

16
bin/platformio-custom.py Normal file
View File

@@ -0,0 +1,16 @@
Import("projenv")
import configparser
prefsLoc = projenv["PROJECT_DIR"] + "/version.properties"
config = configparser.RawConfigParser()
config.read(prefsLoc)
version = dict(config.items('VERSION'))
verStr = "{}.{}.{}".format(version["major"], version["minor"], version["build"])
print(f"Using meshtastic platform-custom.py, firmare version {verStr}")
# General options that are passed to the C and C++ compilers
projenv.Append(CCFLAGS=[
f"-DAPP_VERSION={verStr}"
])

View File

@@ -1,6 +1,6 @@
set -e
source bin/version.sh
VERSION=`bin/buildinfo.py`
esptool.py --baud 921600 write_flash 0x10000 release/latest/bins/firmware-tbeam-US-$VERSION.bin

View File

@@ -0,0 +1,6 @@
set -e
source bin/version.sh
esptool.py --baud 921600 write_flash 0x10000 release/latest/bins/universal/firmware-tbeam-$VERSION.bin

6
bin/qspi-flash-test.sh Executable file
View File

@@ -0,0 +1,6 @@
# You probably don't need this - it is a basic test of the serial flash on the TTGO eink board
nrfjprog -qspiini nrf52/ttgo_eink_qpsi.ini --qspieraseall
nrfjprog --qspiini nrf52/ttgo_eink_qpsi.ini --memwr 0x12000000 --val 0xdeadbeef --verify
nrfjprog --qspiini nrf52/ttgo_eink_qpsi.ini --readqspi spi.hex
objdump -s spi.hex | less

View File

@@ -1,6 +1,15 @@
#!/bin/bash
echo "This script requires https://jpa.kapsi.fi/nanopb/download/ version 0.4.1"
set -e
echo "This script requires https://jpa.kapsi.fi/nanopb/download/ version 0.4.4 to be located in the"
echo "meshtastic-device root directory if the following step fails, you should download the correct"
echo "prebuilt binaries for your computer into nanopb-0.4.4"
# the nanopb tool seems to require that the .options file be in the current directory!
cd proto
../../nanopb-0.4.1-linux-x86/generator-bin/protoc --nanopb_out=-v:../src/mesh -I=../proto mesh.proto
../nanopb-0.4.4/generator-bin/protoc --nanopb_out=-v:../src/mesh -I=../proto *.proto
echo "Regenerating protobuf documentation - if you see an error message"
echo "you can ignore it unless doing a new protobuf release to github."
bin/regen-docs.sh

314
bin/uf2conv.py Executable file
View File

@@ -0,0 +1,314 @@
#!/usr/bin/env python3
import sys
import struct
import subprocess
import re
import os
import os.path
import argparse
UF2_MAGIC_START0 = 0x0A324655 # "UF2\n"
UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected
UF2_MAGIC_END = 0x0AB16F30 # Ditto
families = {
'SAMD21': 0x68ed2b88,
'SAML21': 0x1851780a,
'SAMD51': 0x55114460,
'NRF52': 0x1b57745f,
'STM32F0': 0x647824b6,
'STM32F1': 0x5ee21072,
'STM32F2': 0x5d1a0a2e,
'STM32F3': 0x6b846188,
'STM32F4': 0x57755a57,
'STM32F7': 0x53b80f00,
'STM32G0': 0x300f5633,
'STM32G4': 0x4c71240a,
'STM32H7': 0x6db66082,
'STM32L0': 0x202e3a91,
'STM32L1': 0x1e1f432d,
'STM32L4': 0x00ff6919,
'STM32L5': 0x04240bdf,
'STM32WB': 0x70d16653,
'STM32WL': 0x21460ff0,
'ATMEGA32': 0x16573617,
'MIMXRT10XX': 0x4FB2D5BD
}
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(b"^[:0-9a-fA-F\r\n]+$", buf):
return True
return False
def convert_from_uf2(buf):
global appstartaddr
numblocks = len(buf) // 512
curraddr = None
outp = b""
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 curraddr == None:
appstartaddr = newaddr
curraddr = 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 += b"\x00\x00\x00\x00"
outp += block[32 : 32 + datalen]
curraddr = newaddr + datalen
return outp
def convert_to_carray(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, " % ord(file_content[i])
outp += "\n};\n"
return outp
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 = b""
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 += block
return outp
class Block:
def __init__(self, addr):
self.addr = addr
self.bytes = bytearray(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
assert (upper & 0xffff) == 0
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('\s+', line)
if len(words) >= 3 and words[1] == "2" and words[2] == "FAT":
drives.append(words[0])
else:
rootpath = "/media"
if sys.platform == "darwin":
rootpath = "/Volumes"
elif sys.platform == "linux":
tmp = rootpath + "/" + os.environ["USER"]
if os.path.isdir(tmp):
rootpath = tmp
for d in os.listdir(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("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 main():
global appstartaddr, familyid
def error(msg):
print(msg)
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('-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('-f' , '--family', dest='family', type=str,
default="0x0",
help='specify familyID - number or name (default: 0x0)')
parser.add_argument('-C' , '--carray', action='store_true',
help='convert binary file to a C array, not UF2')
args = parser.parse_args()
appstartaddr = int(args.base, 0)
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:
outbuf = convert_from_uf2(inpbuf)
ext = "bin"
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)
print("Converting to %s, output size: %d, start address: 0x%x" %
(ext, len(outbuf), appstartaddr))
if args.convert or ext != "uf2":
drives = []
if args.output == None:
args.output = "flash." + ext
else:
drives = get_drives()
if args.output:
write_file(args.output, outbuf)
else:
if len(drives) == 0:
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()

4
bin/upload-to-bootloader.sh Executable file
View File

@@ -0,0 +1,4 @@
echo "Converting to uf2 for NRF52 Adafruit bootloader"
bin/uf2conv.py .pio/build/lora-relay-v2/firmware.hex -f 0xADA52840
# cp flash.uf2 /media/kevinh/FTH*BOOT/

View File

@@ -1,3 +0,0 @@
export VERSION=0.7.5

2
bin/view-map.sh Executable file
View File

@@ -0,0 +1,2 @@
echo using amap tool to display memory map
amap .pio/build/output.map

61
boards/eink.json Normal file
View File

@@ -0,0 +1,61 @@
{
"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"
]
],
"usb_product": "TTGO_eink",
"mcu": "nrf52840",
"variant": "eink",
"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",
"onboard_tools": [
"jlink"
],
"svd_path": "nrf52840.svd"
},
"frameworks": [
"arduino"
],
"name": "TTGO eink (Adafruit BSP)",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"require_upload_port": true,
"speed": 115200,
"protocol": "jlink",
"protocols": [
"jlink",
"nrfjprog",
"stlink"
]
},
"url": "FIXME",
"vendor": "TTGO"
}

46
boards/lora-relay-v1.json Normal file
View File

@@ -0,0 +1,46 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_LORA_RELAY_V1 -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [["0x239A", "0x4404"]],
"usb_product": "LORA_RELAY",
"mcu": "nrf52840",
"variant": "lora_relay_v1",
"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",
"onboard_tools": ["jlink"],
"svd_path": "nrf52840.svd"
},
"frameworks": ["arduino"],
"name": "Meshtastic Lora Relay V1 (Adafruit BSP)",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"require_upload_port": true,
"speed": 115200,
"protocol": "jlink",
"protocols": ["jlink", "nrfjprog", "stlink"]
},
"url": "https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay",
"vendor": "BigCorvus"
}

46
boards/lora-relay-v2.json Normal file
View File

@@ -0,0 +1,46 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_LORA_RELAY_V2 -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [["0x239A", "0x4406"]],
"usb_product": "LORA_RELAY",
"mcu": "nrf52840",
"variant": "lora_relay_v2",
"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",
"onboard_tools": ["jlink"],
"svd_path": "nrf52840.svd"
},
"frameworks": ["arduino"],
"name": "Meshtastic Lora Relay V1 (Adafruit BSP)",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"require_upload_port": true,
"speed": 115200,
"protocol": "jlink",
"protocols": ["jlink", "nrfjprog", "stlink"]
},
"url": "https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay",
"vendor": "BigCorvus"
}

47
boards/nrf52840_dk.json Normal file
View File

@@ -0,0 +1,47 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_PCA10056 -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [["0x239A", "0x4404"]],
"usb_product": "nrf52840dk",
"mcu": "nrf52840",
"variant": "pca10056",
"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",
"onboard_tools": ["jlink"],
"svd_path": "nrf52840.svd"
},
"frameworks": ["arduino"],
"name": "A modified NRF52840-DK devboard (Adafruit BSP)",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"require_upload_port": true,
"speed": 115200,
"protocol": "jlink",
"protocols": ["jlink", "nrfjprog", "stlink"]
},
"url": "https://meshtastic.org/",
"vendor": "Nordic Semi"
}

View File

@@ -1,14 +1,14 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v6.ld"
"ldscript": "nrf52840_s113_v7.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_PCA10056 -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [["0x239A", "0x4404"]],
"usb_product": "SimPPR",
"usb_product": "nrf52840dk",
"mcu": "nrf52840",
"variant": "pca10056-rc-clock",
"variants_dir": "variants",
@@ -16,9 +16,9 @@
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS140",
"sd_name": "s140",
"sd_version": "6.1.1",
"sd_flags": "-DS113",
"sd_name": "s113",
"sd_version": "7.2.0",
"sd_fwid": "0x00B6"
},
"bootloader": {

46
boards/ppr1.json Normal file
View File

@@ -0,0 +1,46 @@
{
"build": {
"arduino": {
"ldscript": "nrf52833_s113_v7.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52833_PPR -DNRF52833_XXAA",
"f_cpu": "64000000L",
"hwids": [["0x239A", "0x4406"]],
"usb_product": "PPR",
"mcu": "nrf52833",
"variant": "ppr",
"variants_dir": "variants",
"bsp": {
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS113",
"sd_name": "s113",
"sd_version": "7.2.0",
"sd_fwid": "0x00b6"
},
"bootloader": {
"settings_addr": "0xFF000"
}
},
"connectivity": ["bluetooth"],
"debug": {
"jlink_device": "nRF52833_xxAA",
"onboard_tools": ["jlink"],
"svd_path": "nrf52833.svd"
},
"frameworks": ["arduino"],
"name": "Meshtastic PPR1 (Adafruit BSP)",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"require_upload_port": true,
"speed": 115200,
"protocol": "jlink",
"protocols": ["jlink", "nrfjprog", "stlink"]
},
"url": "https://meshtastic.org/",
"vendor": "Othernet"
}

55
boards/rak815.json Normal file
View File

@@ -0,0 +1,55 @@
{
"build": {
"arduino":{
"ldscript": "nrf52832_s132_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DNRF52832_XXAA -DNRF52",
"f_cpu": "64000000L",
"hwids": [
[
"0x10c4",
"0xea60"
]
],
"usb_product": "RAK815",
"mcu": "nrf52832",
"variant": "rak815",
"bsp": {
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS132",
"sd_name": "s132",
"sd_version": "6.1.1",
"sd_fwid": "0x00B7"
}
},
"connectivity": [
"bluetooth"
],
"debug": {
"jlink_device": "nRF52832_xxAA",
"svd_path": "nrf52.svd"
},
"frameworks": [
"arduino"
],
"name": "RAK RAK815",
"upload": {
"maximum_ram_size": 65536,
"maximum_size": 524288,
"require_upload_port": true,
"speed": 115200,
"protocol": "nrfutil",
"protocols": [
"jlink",
"nrfjprog",
"nrfutil",
"stlink"
]
},
"url": "https://store.rakwireless.com/products/rak815-hybrid-location-tracker",
"vendor": "RAK"
}

43
data/static/basic.js Normal file
View File

@@ -0,0 +1,43 @@
var meshtasticClient;
var connectionOne;
// Important: the connect action must be called from a user interaction (e.g. button press), otherwise the browsers won't allow the connect
function connect() {
// Create new connection
var httpconn = new meshtasticjs.IHTTPConnection();
// Set connection params
let sslActive;
if (window.location.protocol === 'https:') {
sslActive = true;
} else {
sslActive = false;
}
let deviceIp = window.location.hostname; // Your devices IP here
// Add event listeners that get called when a new packet is received / state of device changes
httpconn.addEventListener('fromRadio', function (packet) { console.log(packet) });
// Connect to the device async, then send a text message
httpconn.connect(deviceIp, sslActive)
.then(result => {
alert('device has been configured')
// This gets called when the connection has been established
// -> send a message over the mesh network. If no recipient node is provided, it gets sent as a broadcast
return httpconn.sendText('meshtastic is awesome');
})
.then(result => {
// This gets called when the message has been sucessfully sent
console.log('Message sent!');
})
.catch(error => { console.log(error); });
}

18
data/static/index.html Normal file
View File

@@ -0,0 +1,18 @@
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title></title>
<script src="/static/meshtastic.js"></script>
<script src="/static/basic.js"></script>
</head>
<body>
<button id="connect_button" onclick="connect()">Connect to Meshtastic device</button>
</body>
</html>

Binary file not shown.

View File

@@ -28,17 +28,27 @@ Not all of these features are fully implemented yet - see **important** disclaim
- Shows direction and distance to all members of your channel
- Directed or broadcast text messages for channel members
- Open and extensible codebase supporting multiple hardware vendors - no lock in to one vendor
- Communication API for bluetooth devices (such as our Android app) to use the mesh. An iOS application is in the works. And [Meshtastic-python](https://pypi.org/project/meshtastic/) provides access from desktop computers.
- Communication API for bluetooth devices (such as our Android app) to use the mesh. An iOS application is in the works. And [Meshtastic-python](https://pypi.org/project/meshtastic/) provides access from desktop computers.
- Very easy sharing of private secured channels. Just share a special link or QR code with friends and they can join your encrypted mesh
This project is currently in beta testing but it is fairly stable and feature complete - if you have questions please [join our discussion forum](https://meshtastic.discourse.group/).
This software is 100% open source and developed by a group of hobbyist experimenters. No warranty is provided, if you'd like to improve it - we'd love your help. Please post in the [forum](https://meshtastic.discourse.group/).
### Beginner's Guide
For an detailed walk-through aimed at beginners, we recommend [meshtastic.letstalkthis.com](https://meshtastic.letstalkthis.com/).
### Related Groups
Telegram group for **Italy**-based users [t.me/meshtastic_italia](http://t.me/meshtastic_italia) (Italian language, unofficial).
# Updates
Note: Updates are happening almost daily, only major updates are listed below. For more details see our forum.
- 09/14/2020 - 1.0.0 Now with over 1700 android users, over 2000 nodes and translated into 15 languages. This project will always be a "beta" experiment, but now quite usable. We are currently selecting 1.1 features in our discussion forum.
- 06/24/2020 - 0.7.x Now with over 1000 android users, over 600 people using the radios and translated into 22 languages. Fairly stable and we are working through bugs to get to 1.0.
- 06/04/2020 - 0.6.7 Beta releases of both the application and the device code are released. Features are fairly solid now with a sizable number of users.
- 04/28/2020 - 0.6.0 [Python API](https://pypi.org/project/meshtastic/) released. Makes it easy to use meshtastic devices as "zero config / just works" mesh transport adapters for other projects.
- 04/20/2020 - 0.4.3 Pretty solid now both for the android app and the device code. Many people have donated translations and code. Probably going to call it a beta soon.
@@ -51,7 +61,7 @@ Note: Updates are happening almost daily, only major updates are listed below. F
Our Android application is available here:
[![Download at https://play.google.com/store/apps/details?id=com.geeksville.mesh](https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png)](https://play.google.com/store/apps/details?id=com.geeksville.mesh&referrer=utm_source%3Dhomepage%26anid%3Dadmob)
[![Download at https://play.google.com/store/apps/details?id=com.geeksville.mesh](https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png)](https://play.google.com/store/apps/details?id=com.geeksville.mesh&referrer=utm_source%3Dgithub-homepage)
The link above will return older more stable releases. We would prefer if you join our alpha-test group, because the application is rapidly improving. Three steps to opt-in to the alpha- test:
@@ -61,18 +71,25 @@ The link above will return older more stable releases. We would prefer if you jo
If you'd like to help with development, the source code is [on github](https://github.com/meshtastic/Meshtastic-Android).
The app is also distributed for Amazon Fire devices via the Amazon appstore: [![Amazon appstore link](https://raw.githubusercontent.com/meshtastic/Meshtastic-device/master/images/amazon-fire-button.png)](https://www.amazon.com/Geeksville-Industries-Meshtastic/dp/B08CY9394Q)
## Supported hardware
We currently support two brands of radios. The [TTGO T-Beam](https://www.aliexpress.com/item/4000119152086.html) and the [Heltec LoRa 32](https://heltec.org/project/wifi-lora-32/). Most people should buy the T-Beam and a 18650 battery (total cost less than \$35). Make
sure to buy the frequency range which is legal for your country. For the USA, you should buy the 915MHz version. Getting a version that include a screen is optional, but highly recommended.
We currently support two brands of radios. The [TTGO T-Beam](https://www.aliexpress.com/item/4001178678568.html) and the [Heltec LoRa 32](https://heltec.org/project/wifi-lora-32/). Most people should buy the T-Beam and a 18650 battery (total cost less than \$35). Also, the version of the T-Beam we link to is shipped with Meshtastic **preinstalled** by TTGO, so you don't have to install it yourself.
Make sure to buy the frequency range which is legal for your country. For the USA, you should buy the 915MHz version. Getting a version that include a screen is optional, but highly recommended.
Instructions for installing prebuilt firmware can be found [here](https://github.com/meshtastic/Meshtastic-esp32/blob/master/README.md).
For a nice printable cases:
For a nice looking cases:
1. TTGO T-Beam V0 see this [design](https://www.thingiverse.com/thing:3773717) by [bsiege](https://www.thingiverse.com/bsiege).
2. TTGO T_Beam V1 see this [design](https://www.thingiverse.com/thing:3830711) by [rwanrooy](https://www.thingiverse.com/rwanrooy) or this [remix](https://www.thingiverse.com/thing:3949330) by [8ung](https://www.thingiverse.com/8ung)
3. Heltec Lora32 see this [design](https://www.thingiverse.com/thing:3125854) by [ornotermes](https://www.thingiverse.com/ornotermes).
- 3D printable cases
1. TTGO T-Beam V0 see this [design](https://www.thingiverse.com/thing:3773717) by [bsiege](https://www.thingiverse.com/bsiege).
2. TTGO T_Beam V1 (SMA) see this [design](https://www.thingiverse.com/thing:3830711) by [rwanrooy](https://www.thingiverse.com/rwanrooy) or this [remix](https://www.thingiverse.com/thing:3949330) by [8ung](https://www.thingiverse.com/8ung)
3. TTGO T_Beam V1 (IPEX) see this [design](https://www.thingiverse.com/thing:4587297) by [drewsed](https://www.thingiverse.com/drewsed)
4. Heltec Lora32 see this [design](https://www.thingiverse.com/thing:3125854) by [ornotermes](https://www.thingiverse.com/ornotermes).
- Laser-cut cases
1. TTGO T_Beam V1 (SMA) see this [design](https://www.thingiverse.com/thing:4552771) by [jefish](https://www.thingiverse.com/jefish)
# IMPORTANT DISCLAIMERS AND FAQ

View File

@@ -0,0 +1,8 @@
| Vendor | Product line | Version | Board labels | Notes | URL |
|---|---|---|---|---|---|
| TTGO | T-Beam | 0.7 | T22_V07 20180711 | LoRa 433/470MHz *OR* LoRa 868/915MHz , <br/>GPS ublox NEO-6M , <br/>battery holder for Li-Ion 18650 | [buy](https://www.aliexpress.com/item/4000574335430.html) |
| TTGO | T-Beam | 1.0 | | | [buy](https://www.aliexpress.com/item/4001178678568.html) |
| TTGO | T-Beam | 1.1 | T22_V11 20191212 | LoRa 433/470MHz *OR* LoRa 868/915MHz *OR* LoRa 923MHz , <br/>GPS ublox NEO-M8N , <br/>battery holder for Li-Ion 18650 | [buy](https://www.aliexpress.com/item/4001178678568.html) |
| TTGO | Lora32 | 2.0 | *missing* | LoRa 433/470MHz *OR* LoRa 868/915MHz , <br/>OLED SSD1306 , <br/>SD card holder | [buy](https://www.aliexpress.com/item/4000211331316.html) |
| TTGO | Lora32 | 2.1 | T3_V1.6 20180606 | LoRa 32 (V2) , <br/>SD card holder | [buy](https://www.aliexpress.com/item/4000119208093.html) |
| Heltec | Lora 32 | V2 | V2 | LoRa 433/470MHz *OR* LoRa 868/915MHz | [buy](https://heltec.org/project/wifi-lora-32/) |

View File

@@ -1,7 +1,7 @@
theme: jekyll-theme-cayman
title: Meshtastic
description: An opensource hiking, pilot, skiing, Signal-App-extending GPS mesh communicator
description: An opensource hiking, pilot, skiing, secure GPS mesh communicator
google_analytics: G-DRZ5H5EXHV
include: [".well-known"]

View File

@@ -4,7 +4,7 @@ This project is still pretty young but moving at a pretty good pace. Not all fea
Most of these problems should be solved by the beta release (within three months):
- We don't make these devices and they haven't been tested by UL or the FCC. If you use them you are experimenting and we can't promise they won't burn your house down ;-)
- The encryption [implementation](software/crypto.md) has not been reviewed by an expert. (Are you an expert? Please help us)
- The encryption implementation is good but see this list of [caveats](software/crypto.md#summary-of-strengthsweaknesses-of-our-current-implementation) to determine risks you might face.
- A number of (straightforward) software work items have to be completed before battery life matches our measurements, currently battery life is about three days. Join us on chat if you want the spreadsheet of power measurements/calculations.
- The Android API needs to be documented better
- No one has written an iOS app yet. But some good souls [are talking about it](https://github.com/meshtastic/Meshtastic-esp32/issues/14) ;-)

Binary file not shown.

Binary file not shown.

BIN
docs/hardware/T-SX1262.pdf Normal file

Binary file not shown.

Binary file not shown.

35
docs/hardware/corvus.md Normal file
View File

@@ -0,0 +1,35 @@
# Notes on @BigCorvus boards
## Board version 1.1
variant name lora_relay_v1
### Remaining TODOs
- power hold for the ST7735
- look at example sketch
- turn on xmit boost
## Recommendations for future boards
@BigCorvus your board is **really** nice. Here's some ideas for the future:
- make the SWDIO header more standard (the small ARM 2x5 micro footprint?) or at least througholes so it is easy to solder a header
## How to program bootloader
Download from here: https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases
```
nrfjprog -f nrf52 --eraseall
Erasing user available code and UICR flash areas.
Applying system reset.
nrfjprog -f nrf52 --program feather_nrf52840_express_bootloader-0.3.2_s140_6.1.1.hex
Parsing hex file.
Reading flash area to program to guarantee it is erased.
Checking that the area to write is not protected.
Programming device.
```
Then reboot the board, if all went well it now shows up as a mountable filesystem on your USB bus.

View File

@@ -0,0 +1,6 @@
https://heltec-automation-docs.readthedocs.io/en/latest/cubecell/index.html
https://github.com/HelTecAutomation/ASR650x-Arduino?utm_source=platformio.org&utm_medium=docs
* Either portfreertos or make not theaded versions of Lock, WorkerThread, Queue (probably the latter).

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 KiB

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,7 @@ See [this site](https://www.rfwireless-world.com/Tutorials/LoRa-channels-list.ht
## LoRaWAN Europe Frequency Band
The maximum power allowed is +14dBM.
The maximum power allowed is +14dBm ERP (Effective Radiated Power, see [this site](https://en.wikipedia.org/wiki/Effective_radiated_power) for more information).
### 433 MHz
@@ -24,7 +24,7 @@ Channel zero starts at 865.20 MHz
LoRaWAN defines 64, 125 kHz channels from 902.3 to 914.9 MHz increments.
The maximum output power for North America is +30 dBM.
The maximum output power for North America is +30 dBm ERP.
The band is from 902 to 928 MHz. It mentions channel number and its respective channel frequency. All the 13 channels are separated by 2.16 MHz with respect to the adjacent channels.
Channel zero starts at 903.08 MHz center frequency.
Channel zero starts at 903.08 MHz center frequency.

View File

@@ -1,37 +1,117 @@
# High priority
# Geeksville's current work queue
- why is the net so chatty now?
- do a release
- device wakes, turns BLE on and phone doesn't notice (while phone was sitting in auto-connect)
- E22 bringup
- encryption review findings writeup
- turn on modem-sleep mode - https://github.com/espressif/arduino-esp32/issues/1142#issuecomment-512428852
You probably don't care about this section - skip to the next one.
For app cleanup:
* DONE only do wantReplies once per packet type, if we change network settings force it again
* update positions and nodeinfos based on packets we just merely witness on the mesh. via isPromsciousPort bool, remove sniffing
* DONE make device build always have a valid version
* DONE do fixed position bug https://github.com/meshtastic/Meshtastic-device/issues/536
* DONE check build guide
* DONE write devapi user guide
* DONE update android code: https://developer.android.com/topic/libraries/view-binding/migration
* DONE test GPIO watch
* DONE set --set-chan-fast, --set-chan-default
* writeup docs on gpio
* DONE make python ping command
* DONE make hello world example service
* DONE have python tool check max packet size before sending to device
* DONE if request was sent reliably, send reply reliably
* DONE require a recent python api to talk to these new device loads
* DONE require a recent android app to talk to these new device loads
* DONE fix handleIncomingPosition
* DONE move want_replies handling into plugins
* DONE on android for received positions handle either old or new positions / user messages
* DONE on android side send old or new positions as needed / user messages
* DONE test python side handle new position/user messages
* DONE make a gpio example. --gpiowrb 4 1, --gpiord 0x444, --gpiowatch 0x3ff
* DONE fix position sending to use new plugin
* DONE Add SinglePortNumPlugin - as the new most useful baseclass
* DONE move positions into regular data packets (use new app framework)
* DONE move user info into regular data packets (use new app framework)
* DONE test that positions, text messages and user info still work
* DONE test that position, text messages and user info work properly with new android app and old device code
* do UDP tunnel
* fix the RTC drift bug
* move python ping functionality into device, reply with rxsnr info
* use channels for gpio security https://github.com/meshtastic/Meshtastic-device/issues/104
* generate autodocs
* MeshPackets for sending should be reference counted so that API clients would have the option of checking sent status (would allow removing the nasty 30 sec timer in gpio watch sending)
For high speed/lots of devices/short range tasks:
- When guessing numhops for sending: if I've heard from many local (0 hop neighbors) decrease hopcount by 2 rather than 1.
This should nicely help 'router' nodes do the right thing when long range, or if there are many local nodes for short range.
- fix timeouts/delays to be based on packet length at current radio settings
* update faq with antennas https://meshtastic.discourse.group/t/range-test-ideas-requested/738/2
* update faq on recommended android version and phones
* add help link inside the app, reference a page on the wiki
* turn on amazon reviews support
* add a tablet layout (with map next to messages) in the android app
# Old docs to merge
MESH RADIO PROTOCOL
Old TODO notes on the mesh radio protocol, merge into real docs someday...
for each named group we have a pre-shared key known by all group members and
wrapped around the device. you can only be in one group at a time (FIXME?!) To
join the group we read a qr code with the preshared key and ParamsCodeEnum. that
gets sent via bluetooth to the device. ParamsCodeEnum maps to a set of various
radio params (regulatory region, center freq, SF, bandwidth, bitrate, power
etc...) so all members of the mesh can have their radios set the same way.
once in that group, we can talk between 254 node numbers.
to get our node number (and announce our presence in the channel) we pick a
random node number and broadcast as that node with WANT-NODENUM(my globally
unique name). If anyone on the channel has seen someone _else_ using that name
within the last 24 hrs(?) they reply with DENY-NODENUM. Note: we might receive
multiple denies. Note: this allows others to speak up for some other node that
might be saving battery right now. Any time we hear from another node (for any
message type), we add that node number to the unpickable list. To dramatically
decrease the odds a node number we request is already used by someone. If no one
denies within TBD seconds, we assume that we have that node number. As long as
we keep talking to folks at least once every 24 hrs, others should remember we
have it.
Once we have a node number we can broadcast POSITION-UPDATE(my globally unique
name, lat, lon, alt, amt battery remaining). All receivers will use this to a)
update the mapping of who is at what node nums, b) the time of last rx, c)
position. If we haven't heard from that node in a while we reply to that node
(only) with our current POSITION_UPDATE state - so that node (presumably just
rejoined the network) can build a map of all participants.
We will periodically broadcast POSITION-UPDATE as needed based on distance moved
or a periodic minimum heartbeat.
If user wants to send a text they can SEND_TEXT(dest user, short text message).
Dest user is a node number, or 0xff for broadcast.
# Medium priority
Items to complete before the first beta release.
Items to complete before 1.0.
- turn on watchdog timer (because lib code seems buggy)
- show battery level as % full
- rx signal measurements -3 marginal, -9 bad, 10 great, -10 means almost unusable. So scale this into % signal strength. preferably as a graph, with an X indicating loss of comms.
# Pre-beta priority
During the beta timeframe the following improvements 'would be nice'
# Post 1.0 ideas
- finish DSR for unicast
- check fcc rules on duty cycle. we might not need to freq hop. https://www.sunfiretesting.com/LoRa-FCC-Certification-Guide/ . Might need to add enforcement for europe though.
- pick channel center frequency based on channel name? "dolphin" would hash to 900Mhz, "cat" to 905MHz etc? allows us to hide the concept of channel # from hte user.
- make a no bluetooth configured yet screen - include this screen in the loop if the user hasn't yet paired
- if radio params change fundamentally, discard the nodedb
- re-enable the bluetooth battery level service on the T-BEAM
- implement first cut of router mode: preferentially handle flooding, and change sleep and GPS behaviors
- provide generalized (but slow) internet message forwarding service if one of our nodes has internet connectivity (MQTT) [ Not a requirement but a personal interest ]
# Low priority
# Low priority ideas
Items after the first final candidate release.
- implement nimble battery level service
- Nimble implement device info service remaining fields (hw version etc)
- Turn on RPA addresses for the device side in Nimble
- Try to teardown less of the Nimble protocol stack across sleep
- dynamic frequency scaling could save a lot of power on ESP32, but it seems to corrupt uart (even with ref_tick set correctly)
- Change back to using a fixed sized MemoryPool rather than MemoryDynamic (see bug #149)
- scan to find channels with low background noise? (Use CAD mode of the RF95 to automatically find low noise channels)
- If the phone doesn't read fromradio mailbox within X seconds, assume the phone is gone and we can stop queing location msgs
@@ -57,9 +137,16 @@ Items after the first final candidate release.
- split out the software update utility so other projects can use it. Have the appload specify the URL for downloads.
- read the PMU battery fault indicators and blink/led/warn user on screen
- discard very old nodedb records (> 1wk)
- add a watchdog timer
- handle millis() rollover in GPS.getTime - otherwise we will break after 50 days
- report esp32 device code bugs back to the mothership via android
- change BLE bonding to something more secure. see comment by pSecurity->setAuthenticationMode(ESP_LE_AUTH_BOND)
Changes related to wifi support on ESP32:
- iram space: https://esp32.com/viewtopic.php?t=8460
- set https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/external-ram.html spi ram bss
- figure out if iram or bluetooth classic caused ble problems
- post bug on esp32-arduino with BLE bug findings
# Spinoff project ideas

14
docs/software/ant.md Normal file
View File

@@ -0,0 +1,14 @@
# ANT protocol notes
SD340 terms are reasonable for NRF52
https://www.thisisant.com/developer/components/nrf52832#tab_protocol_stacks_tab
Profiles to implement:
tracker
https://www.thisisant.com/developer/ant-plus/device-profiles/#4365_tab
ebike
https://www.thisisant.com/developer/ant-plus/device-profiles/#527_tab
no profile for messaging?

View File

@@ -1,15 +1,40 @@
# Build instructions
This project uses the simple PlatformIO build system. You can use the IDE, but for brevity
in these instructions I describe use of their command line tool.
This project uses the simple PlatformIO build system. PlatformIO is an extension to Microsoft VSCode. Workflows from building from the GUI or from the commandline are listed below.
1. Purchase a suitable radio (see above)
If you encounter any problems, please post a question in [our forum](meshtastic.discourse.group). And when you learn a fix, update these instructions for the next person (i.e. edit this file and send in a [pull-request](https://opensource.com/article/19/7/create-pull-request-github) which we will eagerly merge).
## GUI
1. Purchase a suitable [radio](https://github.com/meshtastic/Meshtastic-device/wiki/Hardware-Information).
2. Install [Python](https://www.python.org/downloads/).
3. Install [Git](https://git-scm.com/downloads).
4. Reboot your computer.
5. Install [PlatformIO](https://platformio.org/platformio-ide).
6. Click the PlatformIO icon on the side bar. ![platformio icon](https://user-images.githubusercontent.com/47490997/89482668-77c7ea00-d7ee-11ea-8785-5faf8ff99800.png)
7. Under `Quick Access, Miscellaneous, Clone Git Project` enter the URL of the Meshtastic repo found [here](https://github.com/meshtastic/Meshtastic-device). ![image](https://user-images.githubusercontent.com/47490997/89483047-4c91ca80-d7ef-11ea-91f4-1d53d4e8acd9.png)
8. Select a file location to save the repo.
9. Once loaded, open the `platformio.ini` file.
10. At the line `default_envs` you can change it to the board type you are building for ie. `tlora-v2, tlora-v1, tlora-v2-1-1.6, tbeam, heltec, tbeam0.7` (boards are listed further down in the file).
11. The hardware can be configured for different countries by adding a definition to the `configuration.h` file. `#define HW_VERSION_US` or `HW_VERSION_EU433, HW_VERSION_EU865, HW_VERSION_CN, HW_VERSION_JP`. Other country settings can be found in `MeshRadio.h`. The default is `HW_VERSION_US`.
12. Click the PlatformIO icon on the side bar. Under `Project Tasks` you can now build or upload.
Note - To get a clean build you may have to delete the auto-generated file `./.vscode/c_cpp_properties.json`, close and re-open Visual Studio and WAIT until the file is auto-generated before compiling again.
## Command Line
1. Purchase a suitable [radio](https://github.com/meshtastic/Meshtastic-device/wiki/Hardware-Information).
2. Install [PlatformIO](https://platformio.org/platformio-ide)
3. Download this git repo and cd into it
3. Download this git repo and cd into it:
```
git clone https://github.com/meshtastic/Meshtastic-device.git
cd Meshtastic-device
```
4. Run `git submodule update --init --recursive` to pull in dependencies this project needs.
5. If you are outside the USA, edit [platformio.ini](/platformio.ini) to set the correct frequency range for your country. The line you need to change starts with `hw_version` and instructions are provided above that line. Options are provided for `EU433`, `EU835`, `CN`, `JP` and `US` (default). Pull-requests eagerly accepted for other countries.
5. If you are outside the USA, run "export COUNTRY=EU865" (or whatever) to set the correct frequency range for your country. Options are provided for `EU433`, `EU865`, `CN`, `JP` and `US` (default). Pull-requests eagerly accepted for other countries.
6. Plug the radio into your USB port
7. Type `pio run --environment XXX -t upload` (This command will fetch dependencies, build the project and install it on the board via USB). For XXX, use the board type you have (either `tbeam`, `heltec`, `ttgo-lora32-v1`, `ttgo-lora32-v2`).
7. Type `pio run --environment XXX -t upload` (This command will fetch dependencies, build the project and install it on the board via USB). For XXX, use the board type you have (either `tlora-v2, tlora-v1, tlora-v2-1-1.6, tbeam, heltec, tbeam0.7`).
8. Platform IO also installs a very nice VisualStudio Code based IDE, see their [tutorial](https://docs.platformio.org/en/latest/tutorials/espressif32/arduino_debugging_unit_testing.html) if you'd like to use it.
## Decoding stack traces

View File

@@ -5,33 +5,47 @@ the project developers are not cryptography experts. Therefore we ask two things
- If you are a cryptography expert, please review these notes and our questions below. Can you help us by reviewing our
notes below and offering advice? We will happily give as much or as little credit as you wish ;-).
- Consider our existing solution 'alpha' and probably fairly secure against a not particularly aggressive adversary. But until
it is reviewed by someone smarter than us, assume it might have flaws.
- Consider our existing solution 'alpha' and probably fairly secure against a not particularly aggressive adversary
(but we can't yet make a more confident statement).
## Notes on implementation
## Summary of strengths/weaknesses of our current implementation
Based on comments from reviewers (see below), here's some tips for usage of these radios. So you can know the level of protection offered:
* It is pretty likely that the AES256 security is implemented 'correctly' and an observer will not be able to decode your messages.
* Warning: If an attacker is able to get one of the radios in their position, they could either a) extract the channel key from that device or b) use that radio to listen to new communications.
* Warning: If an attacker is able to get the "Channel QR code/URL" that you share with others - that attacker could then be able to read any messages sent on the channel (either tomorrow or in the past - if they kept a raw copy of those broadcast packets)
Possible future areas of work (if there is enough interest - post in our [forum](https://meshtastic.discourse.group) if you want this):
1. Optionally requiring users to provide a PIN to regain access to the mesh. This could be based on: intentionally locking the device, time since last use, or any member could force all members to reauthenticate,
2. Until a device reauthenticates, any other access via BLE or USB would be blocked (this would protect against attackers who are not prepared to write custom software to extract and reverse engineer meshtastic flash memory)
3. Turning on read-back protection in the device fuse-bits (this would extend protection in #2 to block all but **extremely** advanced attacks involving chip disassembly)
4. Time limiting keys used for message transmission and automatically cycling them on a schedule. This would protect past messages from being decoded even if an attacker learns the current key.
### Notes for reviewers
If you are reviewing our implementation, this is a brief statement of our method.
- We do all crypto at the SubPacket (payload) level only, so that all meshtastic nodes will route for others - even those channels which are encrypted with a different key.
- Mostly based on reading [Wikipedia](<https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Counter_(CTR)>) and using the modes the ESP32 provides support for in hardware.
- We use AES256-CTR as a stream cypher (with zero padding on the last BLOCK) because it is well supported with hardware acceleration.
Parameters for our CTR implementation:
- Our AES key is 128 or 256 bits, shared as part of the 'Channel' specification.
- Each SubPacket will be sent as a series of 16 byte BLOCKS.
- The node number concatenated with the packet number is used as the NONCE. This counter will be stored in flash in the device and should essentially never repeat. If the user makes a new 'Channel' (i.e. picking a new random 256 bit key), the packet number will start at zero. The packet number is sent
in cleartext with each packet. The node number can be derived from the "from" field of each packet.
- Each BLOCK for a packet has an incrementing COUNTER. COUNTER starts at zero for the first block of each packet.
- The IV for each block is constructed by concatenating the NONCE as the upper 96 bits of the IV and the COUNTER as the bottom 32 bits. Note: since our packets are small counter will really never be higher than 32 (five bits).
- The node number concatenated with the packet number is used as the NONCE. This nonce will be stored in flash in the device and should essentially never repeat. If the user makes a new 'Channel' (i.e. picking a new random 256 bit key), the packet number will start at zero.
- The packet number is sent in cleartext with each packet. The node number can be derived from the "from" field of each packet. (Cleartext is acceptable because it merely provides IV for each encryption run)
- Each 16 byte BLOCK for a packet has an incrementing COUNTER. COUNTER starts at zero for the first block of each packet.
- The IV for each block is constructed by concatenating the NONCE as the upper 96 bits of the IV and the COUNTER as the bottom 32 bits. Since our packets are small counter portion will really never be higher than 32 (five bits).
```
You can encrypt separate messages by dividing the nonce_counter buffer in two areas: the first one used for a per-message nonce, handled by yourself, and the second one updated by this function internally.
For example, you might reserve the first 12 bytes for the per-message nonce, and the last 4 bytes for internal use. In that case, before calling this function on a new message you need to set the first 12 bytes of nonce_counter to your chosen nonce value, the last 4 to 0, and nc_off to 0 (which will cause stream_block to be ignored). That way, you can encrypt at most 2**96 messages of up to 2**32 blocks each with the same key.
## Comments from reviewer #1
The per-message nonce (or information sufficient to reconstruct it) needs to be communicated with the ciphertext and must be unique. The recommended way to ensure uniqueness is to use a message counter. An alternative is to generate random nonces, but this limits the number of messages that can be securely encrypted: for example, with 96-bit random nonces, you should not encrypt more than 2**32 messages with the same key.
This reviewer is a cryptography professional, but would like to remain anonymous. We thank them for their comments ;-):
Note that for both stategies, sizes are measured in blocks and that an AES block is 16 bytes.
```
I'm assuming that meshtastic is being used to hike in places where someone capable is trying to break it - like you were going to walk around DefCon using these. I spent about an hour reviewing the encryption, and have the following notes:
## Remaining todo
* The write-up isn't quite as clear as the code.
* The code is using AES-CTR mode correctly to ensure confidentiality.
* The comment for initNonce really covers the necessary information.
* I think the bigger encryption question is "what does the encryption need to do"? As it stands, an attacker who has yet to capture any of the devices cannot reasonably capture text or location data. An attacker who captures any device in the channel/mesh can read everything going to that device, everything stored on that device, and any other communication within the channel that they captured in encrypted form. If that capability basically matches your expectations, it is suitable for whatever adventures this was intended for, then, based on information publicly available or widely disclosed, the encryption is good. If those properties are distressing (like, device history is deliberately limited and you don't want a device captured today to endanger the information sent over the channel yesterday) we could talk about ways to achieve that (most likely synchronizing time and replacing the key with its own SHA256 every X hours, and ensuring the old key is not retained unnecessarily).
* Two other things to keep in mind are that AES-CTR does not itself provide authenticity (e.g. an attacker can flip bits in replaying data and scramble the resulting plaintext), and that the current scheme gives some hints about transmission in the size. So, if you worry about an adversary deliberately messing-up messages or knowing the length of a text message, it looks like those might be possible.
- Have the app change the crypto key when the user generates a new channel
I'm guessing that the network behaves somewhat like a store-and-forward network - or, at least, that the goal is to avoid establishing a two-way connection to transmit data. I'm afraid I haven't worked with mesh networks much, but remember studying them briefly in school about ten years ago.

View File

@@ -1,12 +1,28 @@
# Bluetooth API
# Bluetooth/serial/TCP protocol API
The Bluetooth API is design to have only a few characteristics and most polymorphism comes from the flexible set of Google Protocol Buffers which are sent over the wire. We use protocol buffers extensively both for the bluetooth API and for packets inside the mesh or when providing packets to other applications on the phone.
(This document describes the protocol for external API clients using our devices. If you are interested in running your own code on the device itself, see the [on-device](plugin-api.md) documentation instead)
## A note on MTU sizes
The Device API is design to have only a simple stream of ToRadio and FromRadio packets and all polymorphism comes from the flexible set of Google Protocol Buffers which are sent over the wire. We use protocol buffers extensively both for the bluetooth API and for packets inside the mesh or when providing packets to other applications on the phone.
This device will work with any MTU size, but it is highly recommended that you call your phone's "setMTU function to increase MTU to 512 bytes" as soon as you connect to a service. This will dramatically improve performance when reading/writing packets.
## Streaming version
## MeshBluetoothService
This protocol is **almost** identical when it is deployed over BLE, Serial/USB or TCP (our three currently supported transports for connecting to phone/PC). Most of this document is in terms of the original BLE version, but this section describes the small changes when this API is exposed over a Streaming (non datagram) transport. The streaming version has the following changes:
- We assume the stream is reliable (though the protocol will resynchronize if bytes are lost or corrupted). i.e. we do not include CRCs or error correction codes.
- Packets always have a four byte header (described below) prefixed before each packet. This header provides framing characters and length.
- The stream going towards the radio is only a series of ToRadio packets (with the extra 4 byte headers)
- The stream going towards the PC is a stream of FromRadio packets (with the 4 byte headers), or if the receiver state machine does not see valid header bytes it can (optionally) print those bytes as the debug console from the radio. This allows the device to emit regular serial debugging messages (which can be understood by a terminal program) but also switch to a more structured set of protobufs once it sees that the PC client has sent a protobuf towards it.
The 4 byte header is constructed to both provide framing and to not look line 'normal' 7 bit ASCII.
- Byte 0: START1 (0x94)
- Byte 1: START2 (0xc3)
- Byte 2: MSB of protobuf length
- Byte 3: LSB of protobuf length
The receiver will validate length and if >512 it will assume the packet is corrupted and return to looking for START1. While looking for START1 any other characters are printed as "debug output". For small example implementation of this reader see the meshtastic-python implementation.
## MeshBluetoothService (the BLE API)
This is the main bluetooth service for the device and provides the API your app should use to get information about the mesh, send packets or provision the radio.
@@ -28,7 +44,6 @@ Expected sequence for initial download:
- Read a RadioConfig from "radio" - used to get the channel and radio settings
- Read a User from "user" - to get the username for this node
- Read a MyNodeInfo from "mynode" to get information about this local device
- Write an empty record to "nodeinfo" to restart the nodeinfo reading state machine
- Read a series of NodeInfo packets to build the phone's copy of the current NodeDB for the mesh
- Read a endConfig packet that indicates that the entire state you need has been sent.
- Read a series of MeshPackets until it returns empty to get any messages that arrived for this node while the phone was away
@@ -71,16 +86,20 @@ Not all messages are kept in the fromradio queue (filtered based on SubPacket):
- No WantNodeNum / DenyNodeNum messages are kept
A variable keepAllPackets, if set to true will suppress this behavior and instead keep everything for forwarding to the phone (for debugging)
## Protobuf API
### A note on MTU sizes
This device will work with any MTU size, but it is highly recommended that you call your phone's "setMTU function to increase MTU to 512 bytes" as soon as you connect to a service. This will dramatically improve performance when reading/writing packets.
### Protobuf API
On connect, you should send a want_config_id protobuf to the device. This will cause the device to send its node DB and radio config via the fromradio endpoint. After sending the full DB, the radio will send a want_config_id to indicate it is done sending the configuration.
## Other bluetooth services
### Other bluetooth services
This document focuses on the core mesh service, but it is worth noting that the following other Bluetooth services are also
This document focuses on the core device protocol, but it is worth noting that the following other Bluetooth services are also
provided by the device.
### BluetoothSoftwareUpdate
#### BluetoothSoftwareUpdate
The software update service. For a sample function that performs a software update using this API see [startUpdate](https://github.com/meshtastic/Meshtastic-Android/blob/master/app/src/main/java/com/geeksville/mesh/service/SoftwareUpdateService.kt).
@@ -94,14 +113,15 @@ Characteristics
| e272ebac-d463-4b98-bc84-5cc1a39ee517 | write | data, variable sized, recommended 512 bytes, write one for each block of file |
| 4826129c-c22a-43a3-b066-ce8f0d5bacc6 | write | crc32, write last - writing this will complete the OTA operation, now you can read result |
| 5e134862-7411-4424-ac4a-210937432c77 | read,notify | result code, readable but will notify when the OTA operation completes |
| 5e134862-7411-4424-ac4a-210937432c67 | write | sets the region for programming, currently only 0 (app) or 100 (spiffs) are defined, if not set app is assumed |
| GATT_UUID_SW_VERSION_STR/0x2a28 | read | We also implement these standard GATT entries because SW update probably needs them: |
| GATT_UUID_MANU_NAME/0x2a29 | read | |
| GATT_UUID_HW_VERSION_STR/0x2a27 | read | |
### DeviceInformationService
#### DeviceInformationService
Implements the standard BLE contract for this service (has software version, hardware model, serial number, etc...)
### BatteryLevelService
#### BatteryLevelService
Implements the standard BLE contract service, provides battery level in a way that most client devices should automatically understand (i.e. it should show in the bluetooth devices screen automatically)

View File

@@ -0,0 +1,23 @@
# esp32-arduino build instructions
We build our own custom version of esp32-arduino, in order to get some fixes we've made but haven't yet been merged in master.
These are a set of currently unformatted notes on how to build and install them. Most developers should not care about this, because
you'll automatically get our fixed libraries.
```
last EDF release in arduino is: https://github.com/espressif/arduino-esp32/commit/1977370e6fc069e93ffd8818798fbfda27ae7d99
IDF release/v3.3 46b12a560
IDF release/v3.3 367c3c09c
https://docs.espressif.com/projects/esp-idf/en/release-v3.3/get-started/linux-setup.html
kevinh@kevin-server:~/development/meshtastic/esp32-arduino-lib-builder\$ python /home/kevinh/development/meshtastic/esp32-arduino-lib-builder/esp-idf/components/esptool*py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dout --flash_freq 40m --flash_size detect 0x1000 /home/kevinh/development/meshtastic/esp32-arduino-lib-builder/build/bootloader/bootloader.bin
cp -a out/tools/sdk/* components/arduino/tools/sdk
cp -ar components/arduino/* ~/.platformio/packages/framework-arduinoespressif32
/// @src-fba9d33740f719f712e9f8b07da6ea13/
or
cp -ar out/tools/sdk/* ~/.platformio/packages/framework-arduinoespressif32/tools/sdk
```

View File

@@ -0,0 +1,17 @@
You probably don't care about this ugly file of personal notes ;-)
for taiwan region:
bin/run.sh --set region 8
time only mode
./bin/run.sh --set gps_operation 3
ublox parsing failure
record power measurements and update spreadsheet
have loop methods return allowable sleep time (from their perspective)
increase main cpu sleep time
warn people about crummy gps antennas - add to faq

View File

@@ -1,5 +1,75 @@
# Mesh broadcast algorithm
## Current algorithm
The routing protocol for Meshtastic is really quite simple (and suboptimal). It is heavily influenced by the mesh routing algorithm used in [Radiohead](https://www.airspayce.com/mikem/arduino/RadioHead/) (which was used in very early versions of this project). It has four conceptual layers.
### A note about protocol buffers
Because we want our devices to work across various vendors and implementations, we use [Protocol Buffers](https://github.com/meshtastic/Meshtastic-protobufs) pervasively. For information on how the protocol buffers are used wrt API clients see [sw-design](sw-design.md), for purposes of this document you mostly only
need to consider the MeshPacket and Subpacket message types.
### Layer 1: Non reliable zero hop messaging
This layer is conventional non-reliable lora packet transmission. The transmitted packet has the following representation on the ether:
- A 32 bit LORA preamble (to allow receiving radios to synchronize clocks and start framing). We use a longer than minimum (8 bit) preamble to maximize the amount of time the LORA receivers can stay asleep, which dramatically lowers power consumption.
After the preamble the 16 byte packet header is transmitted. This header is described directly by the PacketHeader class in the C++ source code. But indirectly it matches the first portion of the "MeshPacket" protobuf definition. But notably: this portion of the packet is sent directly as the following 16 bytes (rather than using the protobuf encoding). We do this to both save airtime and to allow receiving radio hardware the option of filtering packets before even waking the main CPU.
- to (4 bytes): the unique NodeId of the destination (or 0xffffffff for NodeNum_BROADCAST)
- from (4 bytes): the unique NodeId of the sender)
- id (4 bytes): the unique (wrt the sending node only) packet ID number for this packet. We use a large (32 bit) packet ID to ensure there is enough unique state to protect any encrypted payload from attack.
- flags (4 bytes): Only a few bits are are currently used - 3 bits for for the "HopLimit" (see below) and 1 bit for "WantAck"
After the packet header the actual packet is placed onto the the wire. These bytes are merely the encrypted packed protobuf encoding of the SubPacket protobuf. A full description of our encryption is available in [crypto](crypto.md). It is worth noting that only this SubPacket is encrypted, headers are not. Which leaves open the option of eventually allowing nodes to route packets without knowing the keys used to encrypt.
NodeIds are constructed from the bottom four bytes of the macaddr of the bluetooth address. Because the OUI is assigned by the IEEE and we currently only support a few CPU manufacturers, the upper byte is defacto guaranteed unique for each vendor. The bottom 3 bytes are guaranteed unique by that vendor.
To prevent collisions all transmitters will listen before attempting to send. If they hear some other node transmitting, they will reattempt transmission in x milliseconds. This retransmission delay is random between FIXME and FIXME (these two numbers are currently hardwired, but really should be scaled based on expected packet transmission time at current channel settings).
### Layer 2: Reliable zero hop messaging
This layer adds reliable messaging between the node and its immediate neighbors (only).
The default messaging provided by layer-1 is extended by setting the "want-ack" flag in the MeshPacket protobuf. If want-ack is set the following documentation from mesh.proto applies:
"""This packet is being sent as a reliable message, we would prefer it to arrive
at the destination. We would like to receive a ack packet in response.
Broadcasts messages treat this flag specially: Since acks for broadcasts would
rapidly flood the channel, the normal ack behavior is suppressed. Instead,
the original sender listens to see if at least one node is rebroadcasting this
packet (because naive flooding algorithm). If it hears that the odds (given
typical LoRa topologies) the odds are very high that every node should
eventually receive the message. So FloodingRouter.cpp generates an implicit
ack which is delivered to the original sender. If after some time we don't
hear anyone rebroadcast our packet, we will timeout and retransmit, using the
regular resend logic."""
If a transmitting node does not receive an ACK (or a NAK) packet within FIXME milliseconds, it will use layer-1 to attempt a retransmission of the sent packet. A reliable packet (at this 'zero hop' level) will be resent a maximum of three times. If no ack or nak has been received by then the local node will internally generate a nak (either for local consumption or use by higher layers of the protocol).
### Layer 3: (Naive) flooding for multi-hop messaging
Given our use-case for the initial release, most of our protocol is built around [flooding](<https://en.wikipedia.org/wiki/Flooding_(computer_networking)>). The implementation is currently 'naive' - i.e. it doesn't try to optimize flooding other than abandoning retransmission once we've seen a nearby receiver has acked the packet. Therefore, for each source packet up to N retransmissions might occur (if there are N nodes in the mesh).
Each node in the mesh, if it sees a packet on the ether with HopLimit set to a value other than zero, it will decrement that HopLimit and attempt retransmission on behalf of the original sending node.
### Layer 4: DSR for multi-hop unicast messaging
This layer is not yet fully implemented (and not yet used). But eventually (if we stay with our own transport rather than switching to QMesh or Reticulum)
we will use conventional DSR for unicast messaging. Currently (even when not requiring 'broadcasts') we send any multi-hop unicasts as 'broadcasts' so that we can
leverage our (functional) flooding implementation. This is suboptimal but it is a very rare use-case, because the odds are high that most nodes (given our small networks and 'hiking' use case) are within a very small number of hops. When any node witnesses an ack for a packet, it will realize that it can abandon its own
broadcast attempt for that packet.
## Misc notes on remaining tasks
This section is currently poorly formatted, it is mostly a mere set of todo lists and notes for @geeksville during his initial development. After release 1.0 ideas for future optimization include:
- Make flood-routing less naive (because we have GPS and radio signal strength as heuristics to avoid redundant retransmissions)
- If nodes have been user marked as 'routers', preferentially do flooding via those nodes
- Fully implement DSR to improve unicast efficiency (or switch to QMesh/Reticulum as these projects mature)
great source of papers and class notes: http://www.cs.jhu.edu/~cs647/
flood routing improvements
@@ -19,20 +89,21 @@ reliable messaging tasks (stage one for DSR):
- DONE once an ack comes in, remove the packet from the retry list and deliver the ack to the original sender
- DONE after three retries, deliver a no-ack packet to the original sender (i.e. the phone app or mesh router service)
- DONE test one hop ack/nak with the python framework
- Do stress test with acks
- DONE Do stress test with acks
dsr tasks
- oops I might have broken message reception
- DONE oops I might have broken message reception
- DONE Don't use broadcasts for the network pings (close open github issue)
- DONE add ignoreSenders to radioconfig to allow testing different mesh topologies by refusing to see certain senders
- test multihop delivery with the python framework
- DONE test multihop delivery with the python framework
optimizations / low priority:
- read this [this](http://pages.cs.wisc.edu/~suman/pubs/nadv-mobihoc05.pdf) paper and others and make our naive flood routing less naive
- read @cyclomies long email with good ideas on optimizations and reply
- Remove NodeNum assignment algorithm (now that we use 4 byte node nums)
- make android app warn if firmware is too old or too new to talk to
- DONE Remove NodeNum assignment algorithm (now that we use 4 byte node nums)
- DONE make android app warn if firmware is too old or too new to talk to
- change nodenums and packetids in protobuf to be fixed32
- low priority: think more careful about reliable retransmit intervals
- make ReliableRouter.pending threadsafe
@@ -145,23 +216,3 @@ look into the literature for this idea specifically.
build the most recent version of reality, and if some nodes are too far, then nodes closer in will eventually forward their changes to the distributed db.
- construct non ambigious rules for who broadcasts to request db updates. ideally the algorithm should nicely realize node X can see most other nodes, so they should just listen to all those nodes and minimize the # of broadcasts. the distributed picture of nodes rssi could be useful here?
- possibly view the BLE protocol to the radio the same way - just a process of reconverging the node/msgdb database.
# Old notes
FIXME, merge into the above:
good description of batman protocol: https://www.open-mesh.org/projects/open-mesh/wiki/BATMANConcept
interesting paper on lora mesh: https://portal.research.lu.se/portal/files/45735775/paper.pdf
It seems like DSR might be the algorithm used by RadioheadMesh. DSR is described in https://tools.ietf.org/html/rfc4728
https://en.wikipedia.org/wiki/Dynamic_Source_Routing
broadcast solution:
Use naive flooding at first (FIXME - do some math for a 20 node, 3 hop mesh. A single flood will require a max of 20 messages sent)
Then move to MPR later (http://www.olsr.org/docs/report_html/node28.html). Use altitude and location as heursitics in selecting the MPR set
compare to db sync algorithm?
what about never flooding gps broadcasts. instead only have them go one hop in the common case, but if any node X is looking at the position of Y on their gui, then send a unicast to Y asking for position update. Y replies.
If Y were to die, at least the neighbor nodes of Y would have their last known position of Y.

View File

@@ -1,12 +1,119 @@
# NRF52 TODO
- Possibly switch from softdevice to Apachy Newt: https://github.com/espressif/esp-nimble
https://github.com/apache/mynewt-core - use nimble BLE on both ESP32 and NRF52
## RAK815
### PPR1 TODO
* V_BK for the GPS should probably be supplied from something always on
* use S113 soft device 7.2.0
* properly test charge controller config and read battery/charge status
* fix bluetooth
* fix LCD max contrast (currently too high, needs to be about 40?)
* save brightness settings in flash
* make ST7567Wire driver less ugly, move OLED stuff into a common class treee
* add LCD power save mode for lcd per page 31 of datasheet
* add LCD power off sequence per datasheet to lcd driver
* leave LCD screen on most of the time (because it needs little power)
### general nrf52 TODO:
- turn off transitions on eink screens
- change update interval on eink from 1/sec frames to one frame every 5 mins
- enter SDS state at correct time (to protect battery or loss of phone contact)
- show screen on eink when we enter SDS state (with app info and say sleeping)
- require button press to pair
- shrink soft device RAM usage
- get nrf52832 working again (currently OOM)
- i2c gps comms not quite right
- ble: AdafruitBluefruit::begin - adafruit_ble_task was assigned an invalid stack pointer. out of memory?
- measure power draw
### Bootloader
Install our (temporarily hacked up) adafruit bootloader
```
kevinh@kevin-server:~/development/meshtastic/Adafruit_nRF52_Bootloader$ make BOARD=rak815 sd flash
LD rak815_bootloader-0.3.2-111-g9478eb7-dirty.out
text data bss dec hex filename
20888 1124 15006 37018 909a _build/build-rak815/rak815_bootloader-0.3.2-111-g9478eb7-dirty.out
Create rak815_bootloader-0.3.2-111-g9478eb7-dirty.hex
Create rak815_bootloader-0.3.2-111-g9478eb7-dirty-nosd.hex
Flashing: rak815_bootloader-0.3.2-111-g9478eb7-dirty-nosd.hex
nrfjprog --program _build/build-rak815/rak815_bootloader-0.3.2-111-g9478eb7-dirty-nosd.hex --sectoranduicrerase -f nrf52 --reset
Parsing hex file.
Erasing page at address 0x0.
Erasing page at address 0x74000.
Erasing page at address 0x75000.
Erasing page at address 0x76000.
Erasing page at address 0x77000.
Erasing page at address 0x78000.
Erasing page at address 0x79000.
Erasing UICR flash area.
Applying system reset.
Checking that the area to write is not protected.
Programming device.
Applying system reset.
Run.
```
### Appload
tips on installing https://github.com/platformio/platform-nordicnrf52/issues/8#issuecomment-374017768
to see console output over jlink:
```
12:17
in one tab run "bin/nrf52832-gdbserver.sh" - leave this running the whole time while developing/debugging
12:17
~/development/meshtastic/meshtastic-esp32$ bin/nrf52-console.sh
###RTT Client: ************************************************************
###RTT Client: * SEGGER Microcontroller GmbH *
###RTT Client: * Solutions for real time microcontroller applications *
###RTT Client: ************************************************************
###RTT Client: * *
###RTT Client: * (c) 2012 - 2016 SEGGER Microcontroller GmbH *
###RTT Client: * *
###RTT Client: * www.segger.com Support: support@segger.com *
###RTT Client: * *
###RTT Client: ************************************************************
###RTT Client: * *
###RTT Client: * SEGGER J-Link RTT Client Compiled Apr 7 2020 15:01:22 *
###RTT Client: * *
###RTT Client: ************************************************************
###RTT Client: -----------------------------------------------
###RTT Client: Connecting to J-Link RTT Server via localhost:19021 ..............
###RTT Client: Connected.
SEGGER J-Link V6.70c - Real time terminal output
SEGGER J-Link ARM V9.6, SN=69663845
Process: JLinkGDBServerCLExein another tab run:
12:18
On NRF52 I've been using the jlink fake serial console. But since the rak815 has the serial port hooked up we can switch back to that once the basics are working.
```
## Misc work items
RAM investigation.
nRF52832-QFAA 64KB ram, 512KB flash vs
nrf52832-QFAB 32KB ram, 512kb flash
nrf52833 128KB RAM
nrf52840 256KB RAM, 1MB flash
Manual hacks needed to build (for now):
kevinh@kevin-server:~/.platformio/packages/framework-arduinoadafruitnrf52/variants\$ ln -s ~/development/meshtastic/meshtastic-esp32/variants/\* .
## Initial work items
Minimum items needed to make sure hardware is good.
- set power UICR per https://devzone.nordicsemi.com/f/nordic-q-a/28562/nrf52840-regulator-configuration
- DONE set power UICR per https://devzone.nordicsemi.com/f/nordic-q-a/28562/nrf52840-regulator-configuration
- switch charge controller into / out of performance mode (see 8.3.1 in datasheet)
- write UC1701 wrapper
- Test hardfault handler for null ptrs (if one isn't already installed)
@@ -109,7 +216,7 @@ Nice ideas worth considering someday...
- DONE neg 7 error code from receive
- DONE remove unused sx1262 lib from github
- at boot we are starting our message IDs at 1, rather we should start them at a random number. also, seed random based on timer. this could be the cause of our first message not seen bug.
- add a NEMA based GPS driver to test GPS
- add a NMEA based GPS driver to test GPS
- DONE use "variants" to get all gpio bindings
- DONE plug in correct variants for the real board
- turn on DFU assistance in the appload using the nordic DFU helper lib call

34
docs/software/pinetab.md Normal file
View File

@@ -0,0 +1,34 @@
# Pinetab
These are **preliminary** notes on support for Meshtastic in the Pinetab.
A RF95 is connected via a CH341 USB-SPI chip.
Pin assignments:
CS0 from RF95 goes to CS0 on CH341
DIO0 from RF95 goes to INT on CH341
RST from RF95 goes to RST on CH341
This linux driver claims to provide USB-SPI support: https://github.com/gschorcht/spi-ch341-usb
Notes here on using that driver: https://www.linuxquestions.org/questions/linux-hardware-18/ch341-usb-to-spi-adaptor-driver-doesn%27t-work-4175622736/
Or if **absolutely** necessary could bitbang: https://www.cnx-software.com/2018/02/16/wch-ch341-usb-to-serial-chip-gets-linux-driver-to-control-gpios-over-usb/
## Portduino tasks
* How to access spi devices via ioctl (spidev): https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md#:~:text=Troubleshooting-,Overview,bus)%2C%20UARTs%2C%20etc.
* access gpio via libgpiod?
* Use dkms to distribute driver?
* echo 100 > /sys/module/spi_ch341_usb/parameters/poll_period
## Task list
* Port meshtastic to build (under platformio) for a poxix target. spec: no screen, no gpios, sim network interface, posix threads, posix semaphores & queues, IO to the console only
Use ARM linux: https://platformio.org/platforms/linux_arm
And linux native: https://platformio.org/platforms/native
* Test cs341 driver - just test reading/writing a register and detecting interrupts, confirm can see rf95
* Make a radiolib spi module that targets the cs341 (and builds on linux)
* use new radiolib module to hook pinebook lora to meshtastic, confirm mesh discovery works
* Make a subclass of StreamAPI that works as a posix TCP server
* Use new TCP endpoint from meshtastic-python

View File

@@ -0,0 +1,76 @@
# Plugin-API
This is a tutorial on how to write small plugins which run on the device. Plugins are bits regular 'arduino' code that can send and receive packets to other nodes/apps/PCs using our mesh.
## Key concepts
All plugins should be subclasses of MeshPlugin. By inheriting from this class and creating an instance of your new plugin your plugin will be automatically registered to receive packets.
Messages are sent to particular port numbers (similar to UDP networking). Your new plugin should eventually pick its own port number (see below), but at first you can simply use PRIVATE_APP (which is the default).
Packets can be sent/received either as raw binary structures or as [Protobufs](https://developers.google.com/protocol-buffers).
### Class heirarchy
The relevant bits of the class heirarchy are as follows
* [MeshPlugin](/src/mesh/MeshPlugin.h) (in src/mesh/MeshPlugin.h) - you probably don't want to use this baseclass directly
* [SinglePortPlugin](/src/mesh/SinglePortPlugin.h) (in src/mesh/SinglePortPlugin.h) - for plugins that receive from a single port number (the normal case)
* [ProtobufPlugin](/src/mesh/ProtobufPlugin.h) (in src/mesh/ProtobufPlugin.h) - for plugins that are sending/receiving a single particular Protobuf type. Inherit from this if you are using protocol buffers in your plugin.
You will typically want to inherit from either SinglePortPlugin (if you are just sending raw bytes) or ProtobufPlugin (if you are sending protobufs). You'll implement your own handleReceived/handleReceivedProtobuf - probably based on the example code.
If your plugin needs to perform any operations at startup you can override and implement the setup() method to run your code.
If you need to send a packet you can call service.sendToMesh with code like this (from the examples):
```
MeshPacket *p = allocReply();
p->to = dest;
service.sendToMesh(p);
```
## Example plugins
A number of [key services](/src/plugins) are implemented using the plugin API, these plugins are as follows:
* [TextMessagePlugin](/src/plugins/TextMessagePlugin.h) - receives text messages and displays them on the LCD screen/stores them in the local DB
* [NodeInfoPlugin](/src/plugins/NodeInfoPlugin.h) - receives/sends User information to other nodes so that usernames are available in the databases
* [RemoteHardwarePlugin](/src/plugins/RemoteHardwarePlugin.h) - a plugin that provides easy remote access to device hardware (for things like turning GPIOs on or off). Intended to be a more extensive example and provide a useful feature of its own. See [remote-hardware](remote-hardware.md) for details.
* [ReplyPlugin](/src/plugins/ReplyPlugin.h) - a simple plugin that just replies to any packet it receives (provides a 'ping' service).
## Getting started
The easiest way to get started is:
* [Build and install](build-instructions.md) the standard codebase from github.
* Copy [src/plugins/ReplyPlugin.*](/src/plugins/ReplyPlugin.cpp) into src/plugins/YourPlugin.*. Then change the port number from REPLY_APP to PRIVATE_APP.
* Rebuild with your new messaging goodness and install on the device
* Use the [meshtastic commandline tool](https://github.com/meshtastic/Meshtastic-python) to send a packet to your board "meshtastic --dest 1234 --ping"
## Threading
It is very common that you would like your plugin to be invoked periodically.
We use a crude/basic cooperative threading system to allow this on any of our supported platforms. Simply inherit from OSThread and implement runOnce(). See the OSThread [documentation](/src/concurrency/OSThread.h) for more details. For an example consumer of this API see RemoteHardwarePlugin::runOnce.
## Picking a port number
For any new 'apps' that run on the device or via sister apps on phones/PCs they should pick and use a unique 'portnum' for their application.
If you are making a new app using meshtastic, please send in a pull request to add your 'portnum' to [the master list](https://github.com/meshtastic/Meshtastic-protobufs/blob/master/portnums.proto). PortNums should be assigned in the following range:
* 0-63 Core Meshtastic use, do not use for third party apps
* 64-127 Registered 3rd party apps, send in a pull request that adds a new entry to portnums.proto to register your application
* 256-511 Use one of these portnums for your private applications that you don't want to register publically
* 1024-66559 Are reserved for use by IP tunneling (see FIXME for more information)
All other values are reserved.
## How to add custom protocol buffers
If you would like to use protocol buffers to define the structures you send over the mesh (recommended), here's how to do that.
* Create a new .proto file in the protos directory. You can use the existing [remote_hardware.proto](https://github.com/meshtastic/Meshtastic-protobufs/blob/master/remote_hardware.proto) file as an example.
* Run "bin/regen-protos.sh" to regenerate the C code for accessing the protocol buffers. If you don't have the required nanopb tool, follow the instructions printed by the script to get it.
* Done! You can now use your new protobuf just like any of the existing protobufs in meshtastic.

View File

@@ -32,21 +32,25 @@ From lower to higher power consumption.
onEntry: setBluetoothOn(true)
onExit:
- full on (ON) - Everything is on
onEntry: setBluetoothOn(true), screen.setOn(true)
onExit: screen.setOn(false)
- serial API usage (SERIAL) - Screen is on, device doesn't sleep, bluetooth off
onEntry: setBluetooth off, screen on
onExit:
- full on (ON) - Everything is on, can eventually timeout and lower to a lower power state
onEntry: setBluetoothOn(true), screen.setOn(true)
onExit: screen->setOn(false)
- has power (POWER) - Screen is on, device doesn't sleep, bluetooth on, will stay in this state as long as we have power
onEntry: setBluetooth off, screen on
onExit:
## Behavior
### events that increase CPU activity
- At cold boot: The initial state (after setup() has run) is DARK
- While in DARK: if we receive EVENT_BOOT, transition to ON (and show the bootscreen). This event will be sent if we detect we woke due to reset (as opposed to deep sleep)
- While in LS: Once every position_broadcast_secs (default 15 mins) - the unit will wake into DARK mode and broadcast a "networkPing" (our position) and stay alive for wait_bluetooth_secs (default 30 seconds). This allows other nodes to have a record of our last known position if we go away and allows a paired phone to hear from us and download messages.
- While in LS: Once every position_broadcast_secs (default 15 mins) - the unit will wake into DARK mode and broadcast a "networkPing" (our position) and stay alive for wait_bluetooth_secs (default 60 seconds). This allows other nodes to have a record of our last known position if we go away and allows a paired phone to hear from us and download messages.
- While in LS: Every send*owner_interval (defaults to 4, i.e. one hour), when we wake to send our position we \_also* broadcast our owner. This lets new nodes on the network find out about us or correct duplicate node number assignments.
- While in LS/NB/DARK: If the user presses a button (EVENT_PRESS) we go to full ON mode for screen_on_secs (default 30 seconds). Multiple presses keeps resetting this timeout
- While in LS/NB/DARK: If we receive new text messages (EVENT_RECEIVED_TEXT_MSG), we go to full ON mode for screen_on_secs (same as if user pressed a button)
@@ -56,9 +60,11 @@ From lower to higher power consumption.
- While in NB/DARK/ON: If we receive EVENT_NODEDB_UPDATED we transition to ON (so the new screen can be shown)
- While in DARK: While the phone talks to us over BLE (EVENT_CONTACT_FROM_PHONE) reset any sleep timers and stay in DARK (needed for bluetooth sw update and nice user experience if the user is reading/replying to texts)
- while in LS/NB/DARK: if SERIAL_CONNECTED, go to serial
- while in any state: if we have AC power, go to POWER
### events that decrease cpu activity
- While in POWER: if lose AC go to ON
- While in SERIAL: if SERIAL_DISCONNECTED, go to NB
- While in ON: If PRESS event occurs, reset screen_on_secs timer and tell the screen to handle the pess
- While in ON: If it has been more than screen_on_secs since a press, lower to DARK

6
docs/software/rak815.md Normal file
View File

@@ -0,0 +1,6 @@
# RAK815
Notes on trying to get the RAK815 working with meshtastic.
good tutorial: https://www.hackster.io/naresh-krish/getting-started-with-rak815-tracker-module-and-arduino-1c7bc9
(includes software serial link - possibly useful for GPS)

View File

@@ -0,0 +1,202 @@
23K + messages
+ heap of 70ish packets, 300ish bytes per packet: 20KB
+ 14KB soft device RAM
With max length Data inside the packet
Size of NodeInfo 104
Size of SubPacket 272
Size of MeshPacket 304
If Data was smaller: for 70 data packets we would save 7KB. We would need to make SubPacket.data and MeshPacket.encrypted into "type:FT_POINTER" - variably sized mallocs
Size of NodeInfo 104
Size of SubPacket 96
Size of MeshPacket 292 (could have been much smaller but I forgot to shrink MeshPacket.encrypted)
therefore:
a) we should store all ToPhone message queued messages compressed as protobufs (since they will become that anyways)
b) shrink packet pool size because none of that storage will be used for ToPhone packets
c) don't allocate any storage in RAM for the tophone messages we save inside device state, instead just use nanopb callbacks to save/load those
d) a smarter MeshPacket in memory representation would save about 7KB of RAM. call pb_release before freeing each freshly malloced MeshPacket
- nrf52 free memory https://learn.adafruit.com/bluefruit-nrf52-feather-learning-guide/hathach-memory-map
2000790c 00003558 B devicestate // 16KB
2000b53c 00001000 b _cache_buffer // 4KB flash filesystem support
20003b1c 000006b0 B console
2000d5f4 00000400 b vApplicationGetTimerTaskMemory::uxTimerTaskStack
2000da04 00000400 b _acUpBuffer
2000c558 0000036c B Bluefruit
2000c8d8 00000358 b _cdcd_itf
2000e54c 00000258 B _midid_itf
2000d0dc 00000200 b ucStaticTimerQueueStorage.9390
2000e044 00000200 b _mscd_buf
2000e284 000001cc b _vendord_itf
2000d410 00000190 b vApplicationGetIdleTaskMemory::uxIdleTaskStack
2000374c 0000016c D __global_locale
2000de48 0000012c B USBDevice
2000afa4 00000100 b Router::send(_MeshPacket*)::bytes
2000aea4 00000100 b Router::perhapsDecode(_MeshPacket*)::bytes
200039b0 000000f4 B powerFSM
20004258 000000f0 B screen
2000cd7c 000000c4 b _dcd
2000cc68 000000c0 b _usbd_qdef_buf
2000b3c4 000000bc B Wire
2000cef4 000000a8 B Serial2
2000ce4c 000000a8 B Serial1
2000e498 000000a8 B _SEGGER_RTT
2000b498 000000a4 B InternalFS
2000dfb8 0000008c b _hidd_itf
2000b260 00000088 b meshtastic::normalFrames
2000cfdc 00000064 b pxReadyTasksLists
2000b340 00000060 b meshtastic::drawTextMessageFrame(OLEDDisplay*, OLEDDisplayUiState*, short, short)::tempBuf
200036ec 00000060 d impure_data
2000b104 00000060 B bledfu
2000b0a4 00000060 B blebas
20003684 00000058 D _usbd_qdef
200038c0 00000058 d tzinfo
2000d5a0 00000054 b vApplicationGetTimerTaskMemory::xTimerTaskTCB
2000d3bc 00000054 b vApplicationGetIdleTaskMemory::xIdleTaskTCB
2000d308 00000050 b xStaticTimerQueue.9389
2000b1f4 00000050 B hrmc
2000b1a4 00000050 B bslc
20004360 0000004c B service
2000d374 00000048 b m_cb
2000df74 00000042 b _desc_str
2000cd3c 00000040 b _usbd_ctrl_buf
20004214 00000040 B realRouter
2000e244 00000040 b _mscd_itf
2000b164 00000040 B bledis
20003634 00000038 d _InternalFSConfig
2000cc30 00000031 b _usbd_dev
2000398c 00000020 B periodicScheduler
2000cfa4 00000020 b callbacksInt
2000de10 0000001f b fw_str.13525
20003974 00000018 b object.9934
2000ae68 00000018 B nodeDB
2000366c 00000018 d _cache
2000b314 00000014 b meshtastic::drawNodeInfo(OLEDDisplay*, OLEDDisplayUiState*, short, short)::signalStr
2000b300 00000014 b meshtastic::drawNodeInfo(OLEDDisplay*, OLEDDisplayUiState*, short, short)::lastStr
2000b2ec 00000014 b meshtastic::drawNodeInfo(OLEDDisplay*, OLEDDisplayUiState*, short, short)::distStr
200041e0 00000014 b getDeviceName()::name
2000d0b8 00000014 b xTasksWaitingTermination
2000d0a4 00000014 b xSuspendedTaskList
2000d08c 00000014 b xPendingReadyList
2000d06c 00000014 b xDelayedTaskList2
2000d058 00000014 b xDelayedTaskList1
2000d2f0 00000014 b xActiveTimerList2
2000d2dc 00000014 b xActiveTimerList1
2000b480 00000014 B SPI
2000c8c4 00000014 B Serial
2000cd28 00000014 b _ctrl_xfer
2000de30 00000011 b serial_str.13534
2000c544 00000010 b BLEAdvertising::_start(unsigned short, unsigned short)::gap_adv
20003614 00000010 d meshtastic::btPIN
2000434c 00000010 b sendOwnerPeriod
2000ae8c 00000010 b staticPool
2000e484 00000010 B xQueueRegistry
20003b04 00000010 B stateSERIAL
20003af4 00000010 B stateSDS
20003ae4 00000010 B stateON
20003ad4 00000010 B stateNB
20003ac4 00000010 B stateLS
20003ab4 00000010 B stateDARK
20003aa4 00000010 B stateBOOT
200041f8 00000010 B ledPeriodic
2000b244 00000010 B hrms
2000d9f4 00000010 b _acDownBuffer
2000b3b8 0000000c B preflightSleep
20004208 0000000c B powerStatus
2000e540 0000000c B nrf_nvic_state
2000b3ac 0000000c B notifySleep
2000b3a0 0000000c B notifyDeepSleep
2000e463 0000000b b __tzname_std
2000e458 0000000b b __tzname_dst
2000b338 00000008 b meshtastic::estimatedHeading(double, double)::oldLon
2000b330 00000008 b meshtastic::estimatedHeading(double, double)::oldLat
200041d0 00000008 b zeroOffsetSecs
2000ae80 00000008 b spiSettings
200038b8 00000008 D _tzname
20003b14 00000008 B noopPrint
2000cfc4 00000008 b channelMap
2000cf9c 00000008 b callbackDeferred
200043ac 00000006 b ourMacAddr
2000435c 00000004 b MeshService::onGPSChanged(void*)::lastGpsSend
2000b32c 00000004 b meshtastic::estimatedHeading(double, double)::b
2000b328 00000004 b meshtastic::drawNodeInfo(OLEDDisplay*, OLEDDisplayUiState*, short, short)::simRadian
2000362c 00000004 d meshtastic::Screen::setup()::bootFrames
20003628 00000004 d meshtastic::Screen::handleStartBluetoothPinScreen(unsigned long)::btFrames
200039ac 00000004 b onEnter()::lastPingMs
2000ae9c 00000004 b generatePacketId()::i
2000ae88 00000004 B RadioLibInterface::instance
2000b2e8 00000004 b meshtastic::nodeIndex
20003610 00000004 d meshtastic::targetFramerate
2000c554 00000004 B BLEService::lastService
200041cc 00000004 b timeStartMsec
200036dc 00000004 d sbrk_heap_top
2000d364 00000004 b _loopHandle
2000c540 00000004 b guard variable for BLEAdvertising::_start(unsigned short, unsigned short)::gap_adv
2000d0d0 00000004 b xYieldPending
2000d35c 00000004 b xTimerTaskHandle
2000d358 00000004 b xTimerQueue
2000d0cc 00000004 b xTickCount
2000d0a0 00000004 b xSchedulerRunning
2000d088 00000004 b xNumOfOverflows
2000d084 00000004 b xNextTaskUnblockTime
2000d304 00000004 b xLastTime.9343
2000d080 00000004 b xIdleTaskHandle
2000d054 00000004 b uxTopReadyPriority
2000d050 00000004 b uxTaskNumber
2000d04c 00000004 b uxSchedulerSuspended
2000d048 00000004 b uxPendedTicks
2000d044 00000004 b uxDeletedTasksWaitingCleanUp
2000d040 00000004 b uxCurrentNumberOfTasks
2000d360 00000004 b uxCriticalNesting
2000cc64 00000004 b _usbd_q
2000e478 00000004 B _timezone
200036e0 00000004 D SystemCoreClock
2000c53c 00000004 b _sem
2000d0d8 00000004 b pxOverflowTimerList
2000cfd8 00000004 b pxOverflowDelayedTaskList
2000cfd4 00000004 b pxDelayedTaskList
2000d0d4 00000004 b pxCurrentTimerList
2000cfd0 00000004 B pxCurrentTCB
2000e470 00000004 b prev_tzenv
2000360c 00000004 D preftmp
20003608 00000004 D preffile
2000b25c 00000004 B nrf52Bluetooth
2000d370 00000004 b m_usbevt_handler
2000d36c 00000004 b m_sleepevt_handler
2000d368 00000004 b m_pofwarn_handler
2000e454 00000004 B __malloc_sbrk_start
2000e450 00000004 B __malloc_free_list
2000e480 00000004 B MAIN_MonCnt
2000e47c 00000004 b initial_env
200036e8 00000004 D _impure_ptr
200041d8 00000004 B gps
2000e7a4 00000004 B errno
20003918 00000004 D environ
2000cfcc 00000004 b enabled
2000ae64 00000004 B displayedNodeNum
2000e474 00000004 B _daylight
2000b254 00000004 B crypto
2000ce44 00000004 B count_duration
2000de0c 00000004 b _cb_task
2000de08 00000004 b _cb_queue
2000de04 00000004 b _cb_qdepth
2000de44 00000004 B bootloaderVersion
200041f5 00000001 b ledBlinker()::ledOn
20003604 00000001 d loop::showingBootScreen
200041f4 00000001 b loop::wasPressed
2000b494 00000001 b DefaultFontTableLookup(unsigned char)::LASTCHAR
2000aea0 00000001 b generatePacketId()::didInit
20003624 00000001 d meshtastic::prevFrame
2000b258 00000001 b bleOn
200041dc 00000001 B timeSetFromGPS
20004348 00000001 B ssd1306_found
2000ce49 00000001 B pin_sound
2000e494 00000001 B nrfx_power_irq_enabled
2000ce48 00000001 B no_stop
20003630 00000001 D neo6M
2000ce40 00000001 b _initialized
200036e4 00000001 D __fdlib_version
20003970 00000001 b completed.9929

View File

@@ -0,0 +1,148 @@
nimble stress test error (private notes for @geeksville)
findings:
only happens when stress testing multiple sleepwake cycles?
failed packets all have initial mbuflen of zero (should be 1)
restarting the connection on phone sometimes (but not always) fixes it (is the larger config nonce pushing packet size up too large?)
- packets >= 79 bytes (FromRadio) cause INVALID_OFFSET (7) gatt errors to be sent to the app
- some packets are missing
theory:
some sort of leak in mbuf storage during unfortunately timed sleep shutdowns
device side
connection updated; status=0 handle=0 our_ota_addr_type=0 our_ota_addr=00:24:62:ab:dd:df
our_id_addr_type=0 our_id_addr=00:24:62:ab:dd:df
peer_ota_addr_type=0 peer_ota_addr=00:7c:d9:5c:ba:2e
peer_id_addr_type=0 peer_id_addr=00:7c:d9:5c:ba:2e
conn_itvl=36 conn_latency=0 supervision_timeout=500 encrypted=1 authenticated=1 bonded=1
BLE fromRadio called
getFromRadio, !available
toRadioWriteCb data 0x3ffc3d72, len 4
Trigger powerFSM 9
Transition powerFSM transition=Contact from phone, from=DARK to=DARK
Client wants config, nonce=6864
Reset nodeinfo read pointer
toRadioWriteCb data 0x3ffc3d72, len 4
Trigger powerFSM 9
Transition powerFSM transition=Contact from phone, from=DARK to=DARK
Client wants config, nonce=6863
Reset nodeinfo read pointer
BLE fromRadio called
getFromRadio, state=2
encoding toPhone packet to phone variant=3, 50 bytes
BLE fromRadio called
getFromRadio, state=3
encoding toPhone packet to phone variant=6, 83 bytes
BLE fromRadio called
getFromRadio, state=4
Sending nodeinfo: num=0xabdddf38, lastseen=1595606850, id=!2462abdddf38, name=Bob b
encoding toPhone packet to phone variant=4, 67 bytes
BLE fromRadio called
getFromRadio, state=4
Sending nodeinfo: num=0x28b200b4, lastseen=1595606804, id=!246f28b200b4, name=Unknown 00b4
encoding toPhone packet to phone variant=4, 80 bytes
BLE fromRadio called
getFromRadio, state=4
Sending nodeinfo: num=0xabf84098, lastseen=1593680756, id=!2462abf84098, name=bx n
encoding toPhone packet to phone variant=4, 72 bytes
BLE fromRadio called
getFromRadio, state=4
Sending nodeinfo: num=0x83f0d8e5, lastseen=1594686931, id=!e8e383f0d8e5, name=Unknown d8e5
encoding toPhone packet to phone variant=4, 64 bytes
BLE fromRadio called
getFromRadio, state=4
Sending nodeinfo: num=0xd1dc7764, lastseen=1595602082, id=!f008d1dc7764, name=dg
encoding toPhone packet to phone variant=4, 52 bytes
BLE fromRadio called
getFromRadio, state=4
Sending nodeinfo: num=0xd1dc7828, lastseen=1595598298, id=!f008d1dc7828, name=ryan
encoding toPhone packet to phone variant=4, 54 bytes
BLE fromRadio called
getFromRadio, state=4
Done sending nodeinfos
getFromRadio, state=5
phone side
2020-07-24 09:11:00.642 6478-6545/com.geeksville.mesh W/com.geeksville.mesh.service.BluetoothInterface: Attempting reconnect
2020-07-24 09:11:00.642 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: Enqueuing work: connect
2020-07-24 09:11:00.642 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth$BluetoothContinuation: Starting work: connect
2020-07-24 09:11:00.643 6478-6545/com.geeksville.mesh D/BluetoothGatt: connect() - device: 24:62:AB:DD:DF:3A, auto: false
2020-07-24 09:11:00.643 6478-6545/com.geeksville.mesh D/BluetoothGatt: registerApp()
2020-07-24 09:11:00.643 6478-6545/com.geeksville.mesh D/BluetoothGatt: registerApp() - UUID=026baf7f-d2de-43f1-961f-4e00e04c6fbb
2020-07-24 09:11:00.645 6478-27868/com.geeksville.mesh D/BluetoothGatt: onClientRegistered() - status=0 clientIf=4
2020-07-24 09:11:01.022 6478-27868/com.geeksville.mesh D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=4 device=24:62:AB:DD:DF:3A
2020-07-24 09:11:01.022 6478-27868/com.geeksville.mesh I/com.geeksville.mesh.service.SafeBluetooth: new bluetooth connection state 2, status 0
2020-07-24 09:11:01.023 6478-27868/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: work connect is completed, resuming status=0, res=kotlin.Unit
2020-07-24 09:11:01.023 6478-6545/com.geeksville.mesh I/com.geeksville.mesh.service.BluetoothInterface: Connected to radio!
2020-07-24 09:11:01.023 6478-6545/com.geeksville.mesh D/BluetoothGatt: refresh() - device: 24:62:AB:DD:DF:3A
2020-07-24 09:11:01.526 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: Enqueuing work: discover
2020-07-24 09:11:01.526 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth$BluetoothContinuation: Starting work: discover
2020-07-24 09:11:01.526 6478-6545/com.geeksville.mesh D/BluetoothGatt: discoverServices() - device: 24:62:AB:DD:DF:3A
2020-07-24 09:11:01.829 6478-27868/com.geeksville.mesh D/BluetoothGatt: onConnectionUpdated() - Device=24:62:AB:DD:DF:3A interval=6 latency=0 timeout=500 status=0
2020-07-24 09:11:02.008 6478-27868/com.geeksville.mesh D/BluetoothGatt: onSearchComplete() = Device=24:62:AB:DD:DF:3A Status=0
2020-07-24 09:11:02.009 6478-27868/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: work discover is completed, resuming status=0, res=kotlin.Unit
2020-07-24 09:11:02.009 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.BluetoothInterface: Discovered services!
2020-07-24 09:11:02.095 6478-27868/com.geeksville.mesh D/BluetoothGatt: onConnectionUpdated() - Device=24:62:AB:DD:DF:3A interval=36 latency=0 timeout=500 status=0
2020-07-24 09:11:03.010 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.RadioInterfaceService: Broadcasting connection=true
2020-07-24 09:11:03.012 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: Enqueuing work: readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5
2020-07-24 09:11:03.012 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth$BluetoothContinuation: Starting work: readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5
2020-07-24 09:11:03.012 6478-6478/com.geeksville.mesh D/com.geeksville.mesh.service.MeshService: Received broadcast com.geeksville.mesh.CONNECT_CHANGED
2020-07-24 09:11:03.012 6478-6478/com.geeksville.mesh D/com.geeksville.mesh.service.MeshService: onConnectionChanged=CONNECTED
2020-07-24 09:11:03.012 6478-6478/com.geeksville.mesh D/com.geeksville.mesh.service.MeshService: Starting config nonce=6878
2020-07-24 09:11:03.013 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.BluetoothInterface: queuing 4 bytes to f75c76d2-129e-4dad-a1dd-7866124401e7 *** sending start config
2020-07-24 09:11:03.013 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: Enqueuing work: writeC f75c76d2-129e-4dad-a1dd-7866124401e7
2020-07-24 09:11:03.015 6478-6478/com.geeksville.mesh D/com.geeksville.mesh.service.MeshService: Received broadcast com.geeksville.mesh.CONNECT_CHANGED
2020-07-24 09:11:03.015 6478-6478/com.geeksville.mesh D/com.geeksville.mesh.service.MeshService: onConnectionChanged=CONNECTED
2020-07-24 09:11:03.015 6478-6478/com.geeksville.mesh D/com.geeksville.mesh.service.MeshService: Starting config nonce=6877
2020-07-24 09:11:03.016 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.MeshService: device sleep timeout cancelled
2020-07-24 09:11:03.016 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.BluetoothInterface: queuing 4 bytes to f75c76d2-129e-4dad-a1dd-7866124401e7
2020-07-24 09:11:03.016 6478-6545/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: Enqueuing work: writeC f75c76d2-129e-4dad-a1dd-7866124401e7
2020-07-24 09:11:03.130 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth$BluetoothContinuation: Starting work: writeC f75c76d2-129e-4dad-a1dd-7866124401e7
2020-07-24 09:11:03.132 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: work readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5 is completed, resuming status=0, res=android.bluetooth.BluetoothGattCharacteristic@556a315
2020-07-24 09:11:03.132 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.BluetoothInterface: Done reading from radio, fromradio is empty
2020-07-24 09:11:03.132 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: starting setNotify(ed9da18c-a800-4f66-a670-aa7547e34453, true) *** start notify
2020-07-24 09:11:03.132 6478-19966/com.geeksville.mesh D/BluetoothGatt: setCharacteristicNotification() - uuid: ed9da18c-a800-4f66-a670-aa7547e34453 enable: true
2020-07-24 09:11:03.133 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: Enqueuing work: writeD
2020-07-24 09:11:03.220 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth$BluetoothContinuation: Starting work: writeC f75c76d2-129e-4dad-a1dd-7866124401e7
2020-07-24 09:11:03.221 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: work writeC f75c76d2-129e-4dad-a1dd-7866124401e7 is completed, resuming status=0, res=android.bluetooth.BluetoothGattCharacteristic@2d2062a
2020-07-24 09:11:03.221 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.BluetoothInterface: write of 4 bytes completed
2020-07-24 09:11:03.221 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: Enqueuing work: readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5
2020-07-24 09:11:03.310 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth$BluetoothContinuation: Starting work: writeD
2020-07-24 09:11:03.311 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: work writeC f75c76d2-129e-4dad-a1dd-7866124401e7 is completed, resuming status=0, res=android.bluetooth.BluetoothGattCharacteristic@2d2062a
2020-07-24 09:11:03.311 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.BluetoothInterface: write of 4 bytes completed
2020-07-24 09:11:03.400 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth$BluetoothContinuation: Starting work: readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5
2020-07-24 09:11:03.402 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: work writeD is completed, resuming status=0, res=android.bluetooth.BluetoothGattDescriptor@fc99c1b
2020-07-24 09:11:03.402 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: Notify enable=true completed
2020-07-24 09:11:03.769 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: work readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5 is completed, resuming status=0, res=android.bluetooth.BluetoothGattCharacteristic@556a315
2020-07-24 09:11:03.769 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.BluetoothInterface: Received 80 bytes from radio **** received an 80 byte fromradio. Why did we miss three previous reads?
2020-07-24 09:11:03.774 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: Enqueuing work: readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5
2020-07-24 09:11:03.774 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth$BluetoothContinuation: Starting work: readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5
2020-07-24 09:11:03.774 6478-6478/com.geeksville.mesh D/com.geeksville.mesh.service.MeshService: Received broadcast com.geeksville.mesh.RECEIVE_FROMRADIO
2020-07-24 09:11:03.776 6478-6478/com.geeksville.mesh E/com.geeksville.mesh.service.MeshService: Invalid Protobuf from radio, len=80 (exception Protocol message had invalid UTF-8.)
2020-07-24 09:11:03.776 6478-6478/com.geeksville.mesh D/com.geeksville.mesh.service.MeshService: Received broadcast com.geeksville.mesh.RECEIVE_FROMRADIO
2020-07-24 09:11:03.776 6478-6478/com.geeksville.mesh E/com.geeksville.mesh.service.MeshService: Invalid Protobuf from radio, len=80 (exception Protocol message had invalid UTF-8.)
2020-07-24 09:11:04.031 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: work readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5 is completed, resuming status=0, res=android.bluetooth.BluetoothGattCharacteristic@556a315
2020-07-24 09:11:04.031 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.BluetoothInterface: Received 52 bytes from radio *** received 52 bytes - where did the previous two read results go?
2020-07-24 09:11:04.033 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: Enqueuing work: readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5
2020-07-24 09:11:04.033 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth$BluetoothContinuation: Starting work: readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5
2020-07-24 09:11:04.034 6478-6478/com.geeksville.mesh D/com.geeksville.mesh.service.MeshService: Received broadcast com.geeksville.mesh.RECEIVE_FROMRADIO
2020-07-24 09:11:04.035 6478-6478/com.geeksville.mesh E/com.geeksville.mesh.service.MeshService: Invalid Protobuf from radio, len=52 (exception While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length.)
2020-07-24 09:11:04.036 6478-6478/com.geeksville.mesh D/com.geeksville.mesh.service.MeshService: Received broadcast com.geeksville.mesh.RECEIVE_FROMRADIO
2020-07-24 09:11:04.036 6478-6478/com.geeksville.mesh E/com.geeksville.mesh.service.MeshService: Invalid Protobuf from radio, len=52 (exception While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length.)
2020-07-24 09:11:04.210 6478-19966/com.geeksville.mesh D/com.geeksville.mesh.service.SafeBluetooth: work readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5 is completed, resuming status=7, res=android.bluetooth.BluetoothGattCharacteristic@556a315 *** read failed
2020-07-24 09:11:04.211 6478-19966/com.geeksville.mesh W/com.geeksville.mesh.service.BluetoothInterface: Scheduling reconnect because error during doReadFromRadio - disconnecting, Bluetooth status=7 while doing readC 8ba2bcc2-ee02-4a55-a531-c525c5e454d5
2020-07-24 09:11:04.211 6478-6545/com.geeksville.mesh W/com.geeksville.mesh.service.BluetoothInterface: Forcing disconnect and hopefully device will comeback (disabling forced refresh)
2020-07-24 09:11:04.211 6478-6545/com.geeksville.mesh I/com.geeksville.mesh.service.SafeBluetooth: Closing our GATT connection
2020-07-24 09:11:04.211 6478-6545/com.geeksville.mesh D/BluetoothGatt: cancelOpen() - device: 24:62:AB:DD:DF:3A
2020-07-24 09:11:04.214 6478-19966/com.geeksville.mesh D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=4 device=24:62:AB:DD:DF:3A
2020-07-24 09:11:04.215 6478-19966/com.geeksville.mesh I/com.geeksville.mesh.service.SafeBluetooth: new bluetooth connection state 0, status 0
2020-07-24 09:11:04.215 6478-19966/com.geeksville.mesh I/com.geeksville.mesh.service.SafeBluetooth: Got disconnect because we are shutting down, closing gatt
2020-07-24 09:11:04.215 6478-19966/com.geeksville.mesh D/BluetoothGatt: close()

View File

@@ -1,9 +1,10 @@
This is a mini design doc for developing the meshtastic software.
* [Build instructions](build-instructions.md)
* [On device plugin API](plugin-api.md) - a tutorial on how to write small Plugins which run on the device and can message other nodes.
* [TODO](TODO.md) - read this if you are looking for things to do (or curious about currently missing features)
* Our [project board](https://github.com/orgs/meshtastic/projects/1) - shows what things we are currently working on and remaining work items for the current release.
* [Power Management](power.md)
* [Mesh algorithm](mesh-alg.md)
* [Bluetooth API](bluetooth-api.md) and porting guide for new clients (iOS, python, etc...)
* [External client API](device-api.md) and porting guide for new clients (iOS, python, etc...)
* TODO: how to port the device code to a new device.

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -55,7 +55,7 @@
/* Version of the nanopb library. Just in case you want to check it in
* your own program. */
#define NANOPB_VERSION nanopb-0.4.1
#define NANOPB_VERSION nanopb-0.4.4
/* Include all the system headers needed by nanopb. You will need the
* definitions of the following:
@@ -276,17 +276,18 @@ typedef struct pb_field_iter_s pb_field_iter_t;
/* This structure is used in auto-generated constants
* to specify struct fields.
*/
PB_PACKED_STRUCT_START
typedef struct pb_msgdesc_s pb_msgdesc_t;
struct pb_msgdesc_s {
pb_size_t field_count;
const uint32_t *field_info;
const pb_msgdesc_t * const * submsg_info;
const pb_byte_t *default_value;
bool (*field_callback)(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_iter_t *field);
} pb_packed;
PB_PACKED_STRUCT_END
pb_size_t field_count;
pb_size_t required_field_count;
pb_size_t largest_tag;
};
/* Iterator for message descriptor */
struct pb_field_iter_s {
@@ -469,137 +470,181 @@ struct pb_extension_s {
}; \
const pb_msgdesc_t structname ## _msg = \
{ \
0 msgname ## _FIELDLIST(PB_GEN_FIELD_COUNT, structname), \
structname ## _field_info, \
structname ## _submsg_info, \
msgname ## _DEFAULT, \
msgname ## _CALLBACK, \
0 msgname ## _FIELDLIST(PB_GEN_FIELD_COUNT, structname), \
0 msgname ## _FIELDLIST(PB_GEN_REQ_FIELD_COUNT, structname), \
0 msgname ## _FIELDLIST(PB_GEN_LARGEST_TAG, structname), \
}; \
msgname ## _FIELDLIST(PB_GEN_FIELD_INFO_ASSERT_ ## width, structname)
#define PB_GEN_FIELD_COUNT(structname, atype, htype, ltype, fieldname, tag) +1
#define PB_GEN_REQ_FIELD_COUNT(structname, atype, htype, ltype, fieldname, tag) \
+ (PB_HTYPE_ ## htype == PB_HTYPE_REQUIRED)
#define PB_GEN_LARGEST_TAG(structname, atype, htype, ltype, fieldname, tag) \
* 0 + tag
/* X-macro for generating the entries in struct_field_info[] array. */
#define PB_GEN_FIELD_INFO_1(structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO(1, structname, atype, htype, ltype, fieldname, tag)
PB_FIELDINFO_1(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
#define PB_GEN_FIELD_INFO_2(structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO(2, structname, atype, htype, ltype, fieldname, tag)
PB_FIELDINFO_2(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
#define PB_GEN_FIELD_INFO_4(structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO(4, structname, atype, htype, ltype, fieldname, tag)
PB_FIELDINFO_4(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
#define PB_GEN_FIELD_INFO_8(structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO(8, structname, atype, htype, ltype, fieldname, tag)
PB_FIELDINFO_8(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
#define PB_GEN_FIELD_INFO_AUTO(structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO_AUTO2(PB_FIELDINFO_WIDTH_AUTO(atype, htype, ltype), structname, atype, htype, ltype, fieldname, tag)
PB_FIELDINFO_AUTO2(PB_FIELDINFO_WIDTH_AUTO(_PB_ATYPE_ ## atype, _PB_HTYPE_ ## htype, _PB_LTYPE_ ## ltype), \
tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
#define PB_GEN_FIELD_INFO_AUTO2(width, structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO(width, structname, atype, htype, ltype, fieldname, tag)
#define PB_FIELDINFO_AUTO2(width, tag, type, data_offset, data_size, size_offset, array_size) \
PB_FIELDINFO_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size)
#define PB_GEN_FIELD_INFO(width, structname, atype, htype, ltype, fieldname, tag) \
PB_FIELDINFO_ ## width(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(htype, structname, fieldname))
#define PB_FIELDINFO_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size) \
PB_FIELDINFO_ ## width(tag, type, data_offset, data_size, size_offset, array_size)
/* X-macro for generating asserts that entries fit in struct_field_info[] array.
* The structure of macros here must match the structure above in PB_GEN_FIELD_INFO_x(),
* but it is not easily reused because of how macro substitutions work. */
#define PB_GEN_FIELD_INFO_ASSERT_1(structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO_ASSERT(1, structname, atype, htype, ltype, fieldname, tag)
PB_FIELDINFO_ASSERT_1(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
#define PB_GEN_FIELD_INFO_ASSERT_2(structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO_ASSERT(2, structname, atype, htype, ltype, fieldname, tag)
PB_FIELDINFO_ASSERT_2(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
#define PB_GEN_FIELD_INFO_ASSERT_4(structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO_ASSERT(4, structname, atype, htype, ltype, fieldname, tag)
PB_FIELDINFO_ASSERT_4(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
#define PB_GEN_FIELD_INFO_ASSERT_8(structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO_ASSERT(8, structname, atype, htype, ltype, fieldname, tag)
PB_FIELDINFO_ASSERT_8(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
#define PB_GEN_FIELD_INFO_ASSERT_AUTO(structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO_ASSERT_AUTO2(PB_FIELDINFO_WIDTH_AUTO(atype, htype, ltype), structname, atype, htype, ltype, fieldname, tag)
PB_FIELDINFO_ASSERT_AUTO2(PB_FIELDINFO_WIDTH_AUTO(_PB_ATYPE_ ## atype, _PB_HTYPE_ ## htype, _PB_LTYPE_ ## ltype), \
tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname))
#define PB_GEN_FIELD_INFO_ASSERT_AUTO2(width, structname, atype, htype, ltype, fieldname, tag) \
PB_GEN_FIELD_INFO_ASSERT(width, structname, atype, htype, ltype, fieldname, tag)
#define PB_FIELDINFO_ASSERT_AUTO2(width, tag, type, data_offset, data_size, size_offset, array_size) \
PB_FIELDINFO_ASSERT_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size)
#define PB_GEN_FIELD_INFO_ASSERT(width, structname, atype, htype, ltype, fieldname, tag) \
PB_FIELDINFO_ASSERT_ ## width(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \
PB_DATA_OFFSET_ ## atype(htype, structname, fieldname), \
PB_DATA_SIZE_ ## atype(htype, structname, fieldname), \
PB_SIZE_OFFSET_ ## atype(htype, structname, fieldname), \
PB_ARRAY_SIZE_ ## atype(htype, structname, fieldname))
#define PB_FIELDINFO_ASSERT_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size) \
PB_FIELDINFO_ASSERT_ ## width(tag, type, data_offset, data_size, size_offset, array_size)
#define PB_DATA_OFFSET_STATIC(htype, structname, fieldname) PB_DATA_OFFSET_ ## htype(structname, fieldname)
#define PB_DATA_OFFSET_POINTER(htype, structname, fieldname) PB_DATA_OFFSET_ ## htype(structname, fieldname)
#define PB_DATA_OFFSET_CALLBACK(htype, structname, fieldname) PB_DATA_OFFSET_ ## htype(structname, fieldname)
#define PB_DATA_OFFSET_REQUIRED(structname, fieldname) offsetof(structname, fieldname)
#define PB_DATA_OFFSET_SINGULAR(structname, fieldname) offsetof(structname, fieldname)
#define PB_DATA_OFFSET_ONEOF(structname, fieldname) offsetof(structname, PB_ONEOF_NAME(FULL, fieldname))
#define PB_DATA_OFFSET_OPTIONAL(structname, fieldname) offsetof(structname, fieldname)
#define PB_DATA_OFFSET_REPEATED(structname, fieldname) offsetof(structname, fieldname)
#define PB_DATA_OFFSET_FIXARRAY(structname, fieldname) offsetof(structname, fieldname)
#define PB_DATA_OFFSET_STATIC(htype, structname, fieldname) PB_DO ## htype(structname, fieldname)
#define PB_DATA_OFFSET_POINTER(htype, structname, fieldname) PB_DO ## htype(structname, fieldname)
#define PB_DATA_OFFSET_CALLBACK(htype, structname, fieldname) PB_DO ## htype(structname, fieldname)
#define PB_DO_PB_HTYPE_REQUIRED(structname, fieldname) offsetof(structname, fieldname)
#define PB_DO_PB_HTYPE_SINGULAR(structname, fieldname) offsetof(structname, fieldname)
#define PB_DO_PB_HTYPE_ONEOF(structname, fieldname) offsetof(structname, PB_ONEOF_NAME(FULL, fieldname))
#define PB_DO_PB_HTYPE_OPTIONAL(structname, fieldname) offsetof(structname, fieldname)
#define PB_DO_PB_HTYPE_REPEATED(structname, fieldname) offsetof(structname, fieldname)
#define PB_DO_PB_HTYPE_FIXARRAY(structname, fieldname) offsetof(structname, fieldname)
#define PB_SIZE_OFFSET_STATIC(htype, structname, fieldname) PB_SIZE_OFFSET_ ## htype(structname, fieldname)
#define PB_SIZE_OFFSET_POINTER(htype, structname, fieldname) PB_SIZE_OFFSET_PTR_ ## htype(structname, fieldname)
#define PB_SIZE_OFFSET_CALLBACK(htype, structname, fieldname) PB_SIZE_OFFSET_CB_ ## htype(structname, fieldname)
#define PB_SIZE_OFFSET_REQUIRED(structname, fieldname) 0
#define PB_SIZE_OFFSET_SINGULAR(structname, fieldname) 0
#define PB_SIZE_OFFSET_ONEOF(structname, fieldname) PB_SIZE_OFFSET_ONEOF2(structname, PB_ONEOF_NAME(FULL, fieldname), PB_ONEOF_NAME(UNION, fieldname))
#define PB_SIZE_OFFSET_ONEOF2(structname, fullname, unionname) PB_SIZE_OFFSET_ONEOF3(structname, fullname, unionname)
#define PB_SIZE_OFFSET_ONEOF3(structname, fullname, unionname) pb_delta(structname, fullname, which_ ## unionname)
#define PB_SIZE_OFFSET_OPTIONAL(structname, fieldname) pb_delta(structname, fieldname, has_ ## fieldname)
#define PB_SIZE_OFFSET_REPEATED(structname, fieldname) pb_delta(structname, fieldname, fieldname ## _count)
#define PB_SIZE_OFFSET_FIXARRAY(structname, fieldname) 0
#define PB_SIZE_OFFSET_PTR_REQUIRED(structname, fieldname) 0
#define PB_SIZE_OFFSET_PTR_SINGULAR(structname, fieldname) 0
#define PB_SIZE_OFFSET_PTR_ONEOF(structname, fieldname) PB_SIZE_OFFSET_ONEOF(structname, fieldname)
#define PB_SIZE_OFFSET_PTR_OPTIONAL(structname, fieldname) 0
#define PB_SIZE_OFFSET_PTR_REPEATED(structname, fieldname) PB_SIZE_OFFSET_REPEATED(structname, fieldname)
#define PB_SIZE_OFFSET_PTR_FIXARRAY(structname, fieldname) 0
#define PB_SIZE_OFFSET_CB_REQUIRED(structname, fieldname) 0
#define PB_SIZE_OFFSET_CB_SINGULAR(structname, fieldname) 0
#define PB_SIZE_OFFSET_CB_ONEOF(structname, fieldname) PB_SIZE_OFFSET_ONEOF(structname, fieldname)
#define PB_SIZE_OFFSET_CB_OPTIONAL(structname, fieldname) 0
#define PB_SIZE_OFFSET_CB_REPEATED(structname, fieldname) 0
#define PB_SIZE_OFFSET_CB_FIXARRAY(structname, fieldname) 0
#define PB_SIZE_OFFSET_STATIC(htype, structname, fieldname) PB_SO ## htype(structname, fieldname)
#define PB_SIZE_OFFSET_POINTER(htype, structname, fieldname) PB_SO_PTR ## htype(structname, fieldname)
#define PB_SIZE_OFFSET_CALLBACK(htype, structname, fieldname) PB_SO_CB ## htype(structname, fieldname)
#define PB_SO_PB_HTYPE_REQUIRED(structname, fieldname) 0
#define PB_SO_PB_HTYPE_SINGULAR(structname, fieldname) 0
#define PB_SO_PB_HTYPE_ONEOF(structname, fieldname) PB_SO_PB_HTYPE_ONEOF2(structname, PB_ONEOF_NAME(FULL, fieldname), PB_ONEOF_NAME(UNION, fieldname))
#define PB_SO_PB_HTYPE_ONEOF2(structname, fullname, unionname) PB_SO_PB_HTYPE_ONEOF3(structname, fullname, unionname)
#define PB_SO_PB_HTYPE_ONEOF3(structname, fullname, unionname) pb_delta(structname, fullname, which_ ## unionname)
#define PB_SO_PB_HTYPE_OPTIONAL(structname, fieldname) pb_delta(structname, fieldname, has_ ## fieldname)
#define PB_SO_PB_HTYPE_REPEATED(structname, fieldname) pb_delta(structname, fieldname, fieldname ## _count)
#define PB_SO_PB_HTYPE_FIXARRAY(structname, fieldname) 0
#define PB_SO_PTR_PB_HTYPE_REQUIRED(structname, fieldname) 0
#define PB_SO_PTR_PB_HTYPE_SINGULAR(structname, fieldname) 0
#define PB_SO_PTR_PB_HTYPE_ONEOF(structname, fieldname) PB_SO_PB_HTYPE_ONEOF(structname, fieldname)
#define PB_SO_PTR_PB_HTYPE_OPTIONAL(structname, fieldname) 0
#define PB_SO_PTR_PB_HTYPE_REPEATED(structname, fieldname) PB_SO_PB_HTYPE_REPEATED(structname, fieldname)
#define PB_SO_PTR_PB_HTYPE_FIXARRAY(structname, fieldname) 0
#define PB_SO_CB_PB_HTYPE_REQUIRED(structname, fieldname) 0
#define PB_SO_CB_PB_HTYPE_SINGULAR(structname, fieldname) 0
#define PB_SO_CB_PB_HTYPE_ONEOF(structname, fieldname) PB_SO_PB_HTYPE_ONEOF(structname, fieldname)
#define PB_SO_CB_PB_HTYPE_OPTIONAL(structname, fieldname) 0
#define PB_SO_CB_PB_HTYPE_REPEATED(structname, fieldname) 0
#define PB_SO_CB_PB_HTYPE_FIXARRAY(structname, fieldname) 0
#define PB_ARRAY_SIZE_STATIC(htype, structname, fieldname) PB_ARRAY_SIZE_ ## htype(structname, fieldname)
#define PB_ARRAY_SIZE_POINTER(htype, structname, fieldname) PB_ARRAY_SIZE_PTR_ ## htype(structname, fieldname)
#define PB_ARRAY_SIZE_STATIC(htype, structname, fieldname) PB_AS ## htype(structname, fieldname)
#define PB_ARRAY_SIZE_POINTER(htype, structname, fieldname) PB_AS_PTR ## htype(structname, fieldname)
#define PB_ARRAY_SIZE_CALLBACK(htype, structname, fieldname) 1
#define PB_ARRAY_SIZE_REQUIRED(structname, fieldname) 1
#define PB_ARRAY_SIZE_SINGULAR(structname, fieldname) 1
#define PB_ARRAY_SIZE_OPTIONAL(structname, fieldname) 1
#define PB_ARRAY_SIZE_ONEOF(structname, fieldname) 1
#define PB_ARRAY_SIZE_REPEATED(structname, fieldname) pb_arraysize(structname, fieldname)
#define PB_ARRAY_SIZE_FIXARRAY(structname, fieldname) pb_arraysize(structname, fieldname)
#define PB_ARRAY_SIZE_PTR_REQUIRED(structname, fieldname) 1
#define PB_ARRAY_SIZE_PTR_SINGULAR(structname, fieldname) 1
#define PB_ARRAY_SIZE_PTR_OPTIONAL(structname, fieldname) 1
#define PB_ARRAY_SIZE_PTR_ONEOF(structname, fieldname) 1
#define PB_ARRAY_SIZE_PTR_REPEATED(structname, fieldname) 1
#define PB_ARRAY_SIZE_PTR_FIXARRAY(structname, fieldname) pb_arraysize(structname, fieldname[0])
#define PB_AS_PB_HTYPE_REQUIRED(structname, fieldname) 1
#define PB_AS_PB_HTYPE_SINGULAR(structname, fieldname) 1
#define PB_AS_PB_HTYPE_OPTIONAL(structname, fieldname) 1
#define PB_AS_PB_HTYPE_ONEOF(structname, fieldname) 1
#define PB_AS_PB_HTYPE_REPEATED(structname, fieldname) pb_arraysize(structname, fieldname)
#define PB_AS_PB_HTYPE_FIXARRAY(structname, fieldname) pb_arraysize(structname, fieldname)
#define PB_AS_PTR_PB_HTYPE_REQUIRED(structname, fieldname) 1
#define PB_AS_PTR_PB_HTYPE_SINGULAR(structname, fieldname) 1
#define PB_AS_PTR_PB_HTYPE_OPTIONAL(structname, fieldname) 1
#define PB_AS_PTR_PB_HTYPE_ONEOF(structname, fieldname) 1
#define PB_AS_PTR_PB_HTYPE_REPEATED(structname, fieldname) 1
#define PB_AS_PTR_PB_HTYPE_FIXARRAY(structname, fieldname) pb_arraysize(structname, fieldname[0])
#define PB_DATA_SIZE_STATIC(htype, structname, fieldname) PB_DATA_SIZE_ ## htype(structname, fieldname)
#define PB_DATA_SIZE_POINTER(htype, structname, fieldname) PB_DATA_SIZE_PTR_ ## htype(structname, fieldname)
#define PB_DATA_SIZE_CALLBACK(htype, structname, fieldname) PB_DATA_SIZE_CB_ ## htype(structname, fieldname)
#define PB_DATA_SIZE_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DATA_SIZE_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DATA_SIZE_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DATA_SIZE_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname))
#define PB_DATA_SIZE_REPEATED(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DATA_SIZE_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DATA_SIZE_PTR_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DATA_SIZE_PTR_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DATA_SIZE_PTR_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DATA_SIZE_PTR_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname)[0])
#define PB_DATA_SIZE_PTR_REPEATED(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DATA_SIZE_PTR_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname[0][0])
#define PB_DATA_SIZE_CB_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DATA_SIZE_CB_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DATA_SIZE_CB_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DATA_SIZE_CB_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname))
#define PB_DATA_SIZE_CB_REPEATED(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DATA_SIZE_CB_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DATA_SIZE_STATIC(htype, structname, fieldname) PB_DS ## htype(structname, fieldname)
#define PB_DATA_SIZE_POINTER(htype, structname, fieldname) PB_DS_PTR ## htype(structname, fieldname)
#define PB_DATA_SIZE_CALLBACK(htype, structname, fieldname) PB_DS_CB ## htype(structname, fieldname)
#define PB_DS_PB_HTYPE_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DS_PB_HTYPE_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DS_PB_HTYPE_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DS_PB_HTYPE_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname))
#define PB_DS_PB_HTYPE_REPEATED(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DS_PB_HTYPE_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DS_PTR_PB_HTYPE_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DS_PTR_PB_HTYPE_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DS_PTR_PB_HTYPE_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DS_PTR_PB_HTYPE_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname)[0])
#define PB_DS_PTR_PB_HTYPE_REPEATED(structname, fieldname) pb_membersize(structname, fieldname[0])
#define PB_DS_PTR_PB_HTYPE_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname[0][0])
#define PB_DS_CB_PB_HTYPE_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DS_CB_PB_HTYPE_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DS_CB_PB_HTYPE_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DS_CB_PB_HTYPE_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname))
#define PB_DS_CB_PB_HTYPE_REPEATED(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_DS_CB_PB_HTYPE_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname)
#define PB_ONEOF_NAME(type, tuple) PB_EXPAND(PB_ONEOF_NAME_ ## type tuple)
#define PB_ONEOF_NAME_UNION(unionname,membername,fullname) unionname
@@ -607,37 +652,37 @@ struct pb_extension_s {
#define PB_ONEOF_NAME_FULL(unionname,membername,fullname) fullname
#define PB_GEN_SUBMSG_INFO(structname, atype, htype, ltype, fieldname, tag) \
PB_SUBMSG_INFO_ ## htype(ltype, structname, fieldname)
PB_SUBMSG_INFO_ ## htype(_PB_LTYPE_ ## ltype, structname, fieldname)
#define PB_SUBMSG_INFO_REQUIRED(ltype, structname, fieldname) PB_SUBMSG_INFO_ ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
#define PB_SUBMSG_INFO_SINGULAR(ltype, structname, fieldname) PB_SUBMSG_INFO_ ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
#define PB_SUBMSG_INFO_OPTIONAL(ltype, structname, fieldname) PB_SUBMSG_INFO_ ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
#define PB_SUBMSG_INFO_REQUIRED(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
#define PB_SUBMSG_INFO_SINGULAR(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
#define PB_SUBMSG_INFO_OPTIONAL(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
#define PB_SUBMSG_INFO_ONEOF(ltype, structname, fieldname) PB_SUBMSG_INFO_ONEOF2(ltype, structname, PB_ONEOF_NAME(UNION, fieldname), PB_ONEOF_NAME(MEMBER, fieldname))
#define PB_SUBMSG_INFO_ONEOF2(ltype, structname, unionname, membername) PB_SUBMSG_INFO_ONEOF3(ltype, structname, unionname, membername)
#define PB_SUBMSG_INFO_ONEOF3(ltype, structname, unionname, membername) PB_SUBMSG_INFO_ ## ltype(structname ## _ ## unionname ## _ ## membername ## _MSGTYPE)
#define PB_SUBMSG_INFO_REPEATED(ltype, structname, fieldname) PB_SUBMSG_INFO_ ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
#define PB_SUBMSG_INFO_FIXARRAY(ltype, structname, fieldname) PB_SUBMSG_INFO_ ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
#define PB_SUBMSG_INFO_BOOL(t)
#define PB_SUBMSG_INFO_BYTES(t)
#define PB_SUBMSG_INFO_DOUBLE(t)
#define PB_SUBMSG_INFO_ENUM(t)
#define PB_SUBMSG_INFO_UENUM(t)
#define PB_SUBMSG_INFO_FIXED32(t)
#define PB_SUBMSG_INFO_FIXED64(t)
#define PB_SUBMSG_INFO_FLOAT(t)
#define PB_SUBMSG_INFO_INT32(t)
#define PB_SUBMSG_INFO_INT64(t)
#define PB_SUBMSG_INFO_MESSAGE(t) PB_SUBMSG_DESCRIPTOR(t)
#define PB_SUBMSG_INFO_MSG_W_CB(t) PB_SUBMSG_DESCRIPTOR(t)
#define PB_SUBMSG_INFO_SFIXED32(t)
#define PB_SUBMSG_INFO_SFIXED64(t)
#define PB_SUBMSG_INFO_SINT32(t)
#define PB_SUBMSG_INFO_SINT64(t)
#define PB_SUBMSG_INFO_STRING(t)
#define PB_SUBMSG_INFO_UINT32(t)
#define PB_SUBMSG_INFO_UINT64(t)
#define PB_SUBMSG_INFO_EXTENSION(t)
#define PB_SUBMSG_INFO_FIXED_LENGTH_BYTES(t)
#define PB_SUBMSG_INFO_ONEOF3(ltype, structname, unionname, membername) PB_SI ## ltype(structname ## _ ## unionname ## _ ## membername ## _MSGTYPE)
#define PB_SUBMSG_INFO_REPEATED(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
#define PB_SUBMSG_INFO_FIXARRAY(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE)
#define PB_SI_PB_LTYPE_BOOL(t)
#define PB_SI_PB_LTYPE_BYTES(t)
#define PB_SI_PB_LTYPE_DOUBLE(t)
#define PB_SI_PB_LTYPE_ENUM(t)
#define PB_SI_PB_LTYPE_UENUM(t)
#define PB_SI_PB_LTYPE_FIXED32(t)
#define PB_SI_PB_LTYPE_FIXED64(t)
#define PB_SI_PB_LTYPE_FLOAT(t)
#define PB_SI_PB_LTYPE_INT32(t)
#define PB_SI_PB_LTYPE_INT64(t)
#define PB_SI_PB_LTYPE_MESSAGE(t) PB_SUBMSG_DESCRIPTOR(t)
#define PB_SI_PB_LTYPE_MSG_W_CB(t) PB_SUBMSG_DESCRIPTOR(t)
#define PB_SI_PB_LTYPE_SFIXED32(t)
#define PB_SI_PB_LTYPE_SFIXED64(t)
#define PB_SI_PB_LTYPE_SINT32(t)
#define PB_SI_PB_LTYPE_SINT64(t)
#define PB_SI_PB_LTYPE_STRING(t)
#define PB_SI_PB_LTYPE_UINT32(t)
#define PB_SI_PB_LTYPE_UINT64(t)
#define PB_SI_PB_LTYPE_EXTENSION(t)
#define PB_SI_PB_LTYPE_FIXED_LENGTH_BYTES(t)
#define PB_SUBMSG_DESCRIPTOR(t) &(t ## _msg),
/* The field descriptors use a variable width format, with width of either
@@ -726,37 +771,37 @@ struct pb_extension_s {
* The generator will give explicit size argument when it knows that a message
* structure grows beyond 1-word format limits.
*/
#define PB_FIELDINFO_WIDTH_AUTO(atype, htype, ltype) PB_FIELDINFO_WIDTH_ ## atype(htype, ltype)
#define PB_FIELDINFO_WIDTH_STATIC(htype, ltype) PB_FIELDINFO_WIDTH_ ## htype(ltype)
#define PB_FIELDINFO_WIDTH_POINTER(htype, ltype) PB_FIELDINFO_WIDTH_ ## htype(ltype)
#define PB_FIELDINFO_WIDTH_CALLBACK(htype, ltype) 2
#define PB_FIELDINFO_WIDTH_REQUIRED(ltype) PB_FIELDINFO_WIDTH_ ## ltype
#define PB_FIELDINFO_WIDTH_SINGULAR(ltype) PB_FIELDINFO_WIDTH_ ## ltype
#define PB_FIELDINFO_WIDTH_OPTIONAL(ltype) PB_FIELDINFO_WIDTH_ ## ltype
#define PB_FIELDINFO_WIDTH_ONEOF(ltype) PB_FIELDINFO_WIDTH_ ## ltype
#define PB_FIELDINFO_WIDTH_REPEATED(ltype) 2
#define PB_FIELDINFO_WIDTH_FIXARRAY(ltype) 2
#define PB_FIELDINFO_WIDTH_BOOL 1
#define PB_FIELDINFO_WIDTH_BYTES 2
#define PB_FIELDINFO_WIDTH_DOUBLE 1
#define PB_FIELDINFO_WIDTH_ENUM 1
#define PB_FIELDINFO_WIDTH_UENUM 1
#define PB_FIELDINFO_WIDTH_FIXED32 1
#define PB_FIELDINFO_WIDTH_FIXED64 1
#define PB_FIELDINFO_WIDTH_FLOAT 1
#define PB_FIELDINFO_WIDTH_INT32 1
#define PB_FIELDINFO_WIDTH_INT64 1
#define PB_FIELDINFO_WIDTH_MESSAGE 2
#define PB_FIELDINFO_WIDTH_MSG_W_CB 2
#define PB_FIELDINFO_WIDTH_SFIXED32 1
#define PB_FIELDINFO_WIDTH_SFIXED64 1
#define PB_FIELDINFO_WIDTH_SINT32 1
#define PB_FIELDINFO_WIDTH_SINT64 1
#define PB_FIELDINFO_WIDTH_STRING 2
#define PB_FIELDINFO_WIDTH_UINT32 1
#define PB_FIELDINFO_WIDTH_UINT64 1
#define PB_FIELDINFO_WIDTH_EXTENSION 1
#define PB_FIELDINFO_WIDTH_FIXED_LENGTH_BYTES 2
#define PB_FIELDINFO_WIDTH_AUTO(atype, htype, ltype) PB_FI_WIDTH ## atype(htype, ltype)
#define PB_FI_WIDTH_PB_ATYPE_STATIC(htype, ltype) PB_FI_WIDTH ## htype(ltype)
#define PB_FI_WIDTH_PB_ATYPE_POINTER(htype, ltype) PB_FI_WIDTH ## htype(ltype)
#define PB_FI_WIDTH_PB_ATYPE_CALLBACK(htype, ltype) 2
#define PB_FI_WIDTH_PB_HTYPE_REQUIRED(ltype) PB_FI_WIDTH ## ltype
#define PB_FI_WIDTH_PB_HTYPE_SINGULAR(ltype) PB_FI_WIDTH ## ltype
#define PB_FI_WIDTH_PB_HTYPE_OPTIONAL(ltype) PB_FI_WIDTH ## ltype
#define PB_FI_WIDTH_PB_HTYPE_ONEOF(ltype) PB_FI_WIDTH ## ltype
#define PB_FI_WIDTH_PB_HTYPE_REPEATED(ltype) 2
#define PB_FI_WIDTH_PB_HTYPE_FIXARRAY(ltype) 2
#define PB_FI_WIDTH_PB_LTYPE_BOOL 1
#define PB_FI_WIDTH_PB_LTYPE_BYTES 2
#define PB_FI_WIDTH_PB_LTYPE_DOUBLE 1
#define PB_FI_WIDTH_PB_LTYPE_ENUM 1
#define PB_FI_WIDTH_PB_LTYPE_UENUM 1
#define PB_FI_WIDTH_PB_LTYPE_FIXED32 1
#define PB_FI_WIDTH_PB_LTYPE_FIXED64 1
#define PB_FI_WIDTH_PB_LTYPE_FLOAT 1
#define PB_FI_WIDTH_PB_LTYPE_INT32 1
#define PB_FI_WIDTH_PB_LTYPE_INT64 1
#define PB_FI_WIDTH_PB_LTYPE_MESSAGE 2
#define PB_FI_WIDTH_PB_LTYPE_MSG_W_CB 2
#define PB_FI_WIDTH_PB_LTYPE_SFIXED32 1
#define PB_FI_WIDTH_PB_LTYPE_SFIXED64 1
#define PB_FI_WIDTH_PB_LTYPE_SINT32 1
#define PB_FI_WIDTH_PB_LTYPE_SINT64 1
#define PB_FI_WIDTH_PB_LTYPE_STRING 2
#define PB_FI_WIDTH_PB_LTYPE_UINT32 1
#define PB_FI_WIDTH_PB_LTYPE_UINT64 1
#define PB_FI_WIDTH_PB_LTYPE_EXTENSION 1
#define PB_FI_WIDTH_PB_LTYPE_FIXED_LENGTH_BYTES 2
/* The mapping from protobuf types to LTYPEs is done using these macros. */
#define PB_LTYPE_MAP_BOOL PB_LTYPE_BOOL

View File

@@ -32,6 +32,10 @@ bool pb_field_iter_next(pb_field_iter_t *iter);
* Returns false if no such field exists. */
bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag);
/* Find a field with type PB_LTYPE_EXTENSION, or return false if not found.
* There can be only one extension range field per message. */
bool pb_field_iter_find_extension(pb_field_iter_t *iter);
#ifdef PB_VALIDATE_UTF8
/* Validate UTF-8 text string */
bool pb_validate_utf8(const char *s);

View File

@@ -113,6 +113,9 @@ bool pb_decode_ex(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_s
* pb_decode() returns with an error, the message is already released.
*/
void pb_release(const pb_msgdesc_t *fields, void *dest_struct);
#else
/* Allocation is not supported, so release is no-op */
#define pb_release(fields, dest_struct) PB_UNUSED(fields); PB_UNUSED(dest_struct);
#endif
@@ -121,11 +124,14 @@ void pb_release(const pb_msgdesc_t *fields, void *dest_struct);
**************************************/
/* Create an input stream for reading from a memory buffer.
*
* msglen should be the actual length of the message, not the full size of
* allocated buffer.
*
* Alternatively, you can use a custom stream that reads directly from e.g.
* a file or a network socket.
*/
pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize);
pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t msglen);
/* Function to read from a pb_istream_t. You can use this if you need to
* read some custom header data, or to read data in field callbacks.

View File

@@ -132,7 +132,7 @@ bool pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count);
* structure. Call this from the callback before writing out field contents. */
bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_iter_t *field);
/* Encode field header by manually specifing wire type. You need to use this
/* Encode field header by manually specifying wire type. You need to use this
* if you want to write out packed arrays from a callback field. */
bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number);

View File

@@ -9,89 +9,102 @@ static bool load_descriptor_values(pb_field_iter_t *iter)
{
uint32_t word0;
uint32_t data_offset;
uint_least8_t format;
int_least8_t size_offset;
if (iter->index >= iter->descriptor->field_count)
return false;
word0 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]);
format = word0 & 3;
iter->tag = (pb_size_t)((word0 >> 2) & 0x3F);
iter->type = (pb_type_t)((word0 >> 8) & 0xFF);
if (format == 0)
switch(word0 & 3)
{
/* 1-word format */
iter->array_size = 1;
size_offset = (int_least8_t)((word0 >> 24) & 0x0F);
data_offset = (word0 >> 16) & 0xFF;
iter->data_size = (pb_size_t)((word0 >> 28) & 0x0F);
}
else if (format == 1)
{
/* 2-word format */
uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]);
case 0: {
/* 1-word format */
iter->array_size = 1;
iter->tag = (pb_size_t)((word0 >> 2) & 0x3F);
size_offset = (int_least8_t)((word0 >> 24) & 0x0F);
data_offset = (word0 >> 16) & 0xFF;
iter->data_size = (pb_size_t)((word0 >> 28) & 0x0F);
break;
}
iter->array_size = (pb_size_t)((word0 >> 16) & 0x0FFF);
iter->tag = (pb_size_t)(iter->tag | ((word1 >> 28) << 6));
size_offset = (int_least8_t)((word0 >> 28) & 0x0F);
data_offset = word1 & 0xFFFF;
iter->data_size = (pb_size_t)((word1 >> 16) & 0x0FFF);
}
else if (format == 2)
{
/* 4-word format */
uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]);
uint32_t word2 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 2]);
uint32_t word3 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 3]);
case 1: {
/* 2-word format */
uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]);
iter->array_size = (pb_size_t)(word0 >> 16);
iter->tag = (pb_size_t)(iter->tag | ((word1 >> 8) << 6));
size_offset = (int_least8_t)(word1 & 0xFF);
data_offset = word2;
iter->data_size = (pb_size_t)word3;
}
else
{
/* 8-word format */
uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]);
uint32_t word2 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 2]);
uint32_t word3 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 3]);
uint32_t word4 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 4]);
iter->array_size = (pb_size_t)((word0 >> 16) & 0x0FFF);
iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 28) << 6));
size_offset = (int_least8_t)((word0 >> 28) & 0x0F);
data_offset = word1 & 0xFFFF;
iter->data_size = (pb_size_t)((word1 >> 16) & 0x0FFF);
break;
}
iter->array_size = (pb_size_t)word4;
iter->tag = (pb_size_t)(iter->tag | ((word1 >> 8) << 6));
size_offset = (int_least8_t)(word1 & 0xFF);
data_offset = word2;
iter->data_size = (pb_size_t)word3;
case 2: {
/* 4-word format */
uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]);
uint32_t word2 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 2]);
uint32_t word3 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 3]);
iter->array_size = (pb_size_t)(word0 >> 16);
iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 8) << 6));
size_offset = (int_least8_t)(word1 & 0xFF);
data_offset = word2;
iter->data_size = (pb_size_t)word3;
break;
}
default: {
/* 8-word format */
uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]);
uint32_t word2 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 2]);
uint32_t word3 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 3]);
uint32_t word4 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 4]);
iter->array_size = (pb_size_t)word4;
iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 8) << 6));
size_offset = (int_least8_t)(word1 & 0xFF);
data_offset = word2;
iter->data_size = (pb_size_t)word3;
break;
}
}
iter->pField = (char*)iter->message + data_offset;
if (size_offset)
{
iter->pSize = (char*)iter->pField - size_offset;
}
else if (PB_HTYPE(iter->type) == PB_HTYPE_REPEATED &&
(PB_ATYPE(iter->type) == PB_ATYPE_STATIC ||
PB_ATYPE(iter->type) == PB_ATYPE_POINTER))
{
/* Fixed count array */
iter->pSize = &iter->array_size;
}
else
if (!iter->message)
{
/* Avoid doing arithmetic on null pointers, it is undefined */
iter->pField = NULL;
iter->pSize = NULL;
}
if (PB_ATYPE(iter->type) == PB_ATYPE_POINTER && iter->pField != NULL)
{
iter->pData = *(void**)iter->pField;
}
else
{
iter->pData = iter->pField;
iter->pField = (char*)iter->message + data_offset;
if (size_offset)
{
iter->pSize = (char*)iter->pField - size_offset;
}
else if (PB_HTYPE(iter->type) == PB_HTYPE_REPEATED &&
(PB_ATYPE(iter->type) == PB_ATYPE_STATIC ||
PB_ATYPE(iter->type) == PB_ATYPE_POINTER))
{
/* Fixed count array */
iter->pSize = &iter->array_size;
}
else
{
iter->pSize = NULL;
}
if (PB_ATYPE(iter->type) == PB_ATYPE_POINTER && iter->pField != NULL)
{
iter->pData = *(void**)iter->pField;
}
else
{
iter->pData = iter->pField;
}
}
if (PB_LTYPE_IS_SUBMSG(iter->type))
@@ -130,17 +143,13 @@ static void advance_iterator(pb_field_iter_t *iter)
pb_type_t prev_type = (prev_descriptor >> 8) & 0xFF;
pb_size_t descriptor_len = (pb_size_t)(1 << (prev_descriptor & 3));
/* Add to fields.
* The cast to pb_size_t is needed to avoid -Wconversion warning.
* Because the data is is constants from generator, there is no danger of overflow.
*/
iter->field_info_index = (pb_size_t)(iter->field_info_index + descriptor_len);
if (PB_HTYPE(prev_type) == PB_HTYPE_REQUIRED)
{
iter->required_field_index++;
}
if (PB_LTYPE_IS_SUBMSG(prev_type))
{
iter->submessage_index++;
}
iter->required_field_index = (pb_size_t)(iter->required_field_index + (PB_HTYPE(prev_type) == PB_HTYPE_REQUIRED));
iter->submessage_index = (pb_size_t)(iter->submessage_index + PB_LTYPE_IS_SUBMSG(prev_type));
}
}
@@ -189,11 +198,23 @@ bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag)
{
return true; /* Nothing to do, correct field already. */
}
else if (tag > iter->descriptor->largest_tag)
{
return false;
}
else
{
pb_size_t start = iter->index;
uint32_t fieldinfo;
if (tag < iter->tag)
{
/* Fields are in tag number order, so we know that tag is between
* 0 and our start position. Setting index to end forces
* advance_iterator() call below to restart from beginning. */
iter->index = iter->descriptor->field_count;
}
do
{
/* Advance iterator but don't load values yet */
@@ -222,6 +243,37 @@ bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag)
}
}
bool pb_field_iter_find_extension(pb_field_iter_t *iter)
{
if (PB_LTYPE(iter->type) == PB_LTYPE_EXTENSION)
{
return true;
}
else
{
pb_size_t start = iter->index;
uint32_t fieldinfo;
do
{
/* Advance iterator but don't load values yet */
advance_iterator(iter);
/* Do fast check for field type */
fieldinfo = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]);
if (PB_LTYPE((fieldinfo >> 8) & 0xFF) == PB_LTYPE_EXTENSION)
{
return load_descriptor_values(iter);
}
} while (iter->index != start);
/* Searched all the way back to start, and found nothing. */
(void)load_descriptor_values(iter);
return false;
}
}
static void *pb_const_cast(const void *p)
{
/* Note: this casts away const, in order to use the common field iterator

View File

@@ -24,19 +24,17 @@
static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t count);
static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *dest, bool *eof);
static bool checkreturn read_raw_value(pb_istream_t *stream, pb_wire_type_t wire_type, pb_byte_t *buf, size_t *size);
static bool checkreturn check_wire_type(pb_wire_type_t wire_type, pb_field_iter_t *field);
static bool checkreturn decode_basic_field(pb_istream_t *stream, pb_field_iter_t *field);
static bool checkreturn decode_basic_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field);
static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field);
static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field);
static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field);
static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field);
static bool checkreturn default_extension_decoder(pb_istream_t *stream, pb_extension_t *extension, uint32_t tag, pb_wire_type_t wire_type);
static bool checkreturn decode_extension(pb_istream_t *stream, uint32_t tag, pb_wire_type_t wire_type, pb_field_iter_t *iter);
static bool checkreturn find_extension_field(pb_field_iter_t *iter);
static bool checkreturn decode_extension(pb_istream_t *stream, uint32_t tag, pb_wire_type_t wire_type, pb_extension_t *extension);
static bool pb_field_set_to_default(pb_field_iter_t *field);
static bool pb_message_set_to_defaults(pb_field_iter_t *iter);
static bool checkreturn pb_dec_bool(pb_istream_t *stream, const pb_field_iter_t *field);
static bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_iter_t *field);
static bool checkreturn pb_dec_fixed(pb_istream_t *stream, const pb_field_iter_t *field);
static bool checkreturn pb_dec_bytes(pb_istream_t *stream, const pb_field_iter_t *field);
static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_iter_t *field);
static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_iter_t *field);
@@ -59,6 +57,8 @@ static void pb_release_single_field(pb_field_iter_t *field);
#define pb_uint64_t uint64_t
#endif
#define PB_WT_PACKED ((pb_wire_type_t)0xFF)
typedef struct {
uint32_t bitfield[(PB_MAX_REQUIRED_FIELDS + 31) / 32];
} pb_fields_seen_t;
@@ -139,7 +139,7 @@ static bool checkreturn pb_readbyte(pb_istream_t *stream, pb_byte_t *buf)
return true;
}
pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize)
pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t msglen)
{
pb_istream_t stream;
/* Cast away the const from buf without a compiler error. We are
@@ -156,7 +156,7 @@ pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t bufsize)
#endif
state.c_state = buf;
stream.state = state.state;
stream.bytes_left = bufsize;
stream.bytes_left = msglen;
#ifndef PB_NO_ERRMSG
stream.errmsg = NULL;
#endif
@@ -205,8 +205,10 @@ static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *d
{
/* Note: The varint could have trailing 0x80 bytes, or 0xFF for negative. */
pb_byte_t sign_extension = (bitpos < 63) ? 0xFF : 0x01;
if ((byte & 0x7F) != 0x00 && ((result >> 31) == 0 || byte != sign_extension))
bool valid_extension = ((byte & 0x7F) == 0x00 ||
((result >> 31) != 0 && byte == sign_extension));
if (bitpos >= 64 || !valid_extension)
{
PB_RETURN_ERROR(stream, "varint overflow");
}
@@ -388,61 +390,70 @@ bool checkreturn pb_close_string_substream(pb_istream_t *stream, pb_istream_t *s
* Decode a single field *
*************************/
static bool checkreturn check_wire_type(pb_wire_type_t wire_type, pb_field_iter_t *field)
static bool checkreturn decode_basic_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field)
{
switch (PB_LTYPE(field->type))
{
case PB_LTYPE_BOOL:
case PB_LTYPE_VARINT:
case PB_LTYPE_UVARINT:
case PB_LTYPE_SVARINT:
return wire_type == PB_WT_VARINT;
if (wire_type != PB_WT_VARINT && wire_type != PB_WT_PACKED)
PB_RETURN_ERROR(stream, "wrong wire type");
case PB_LTYPE_FIXED32:
return wire_type == PB_WT_32BIT;
case PB_LTYPE_FIXED64:
return wire_type == PB_WT_64BIT;
case PB_LTYPE_BYTES:
case PB_LTYPE_STRING:
case PB_LTYPE_SUBMESSAGE:
case PB_LTYPE_SUBMSG_W_CB:
case PB_LTYPE_FIXED_LENGTH_BYTES:
return wire_type == PB_WT_STRING;
default:
return false;
}
}
static bool checkreturn decode_basic_field(pb_istream_t *stream, pb_field_iter_t *field)
{
switch (PB_LTYPE(field->type))
{
case PB_LTYPE_BOOL:
return pb_dec_bool(stream, field);
case PB_LTYPE_VARINT:
case PB_LTYPE_UVARINT:
case PB_LTYPE_SVARINT:
if (wire_type != PB_WT_VARINT && wire_type != PB_WT_PACKED)
PB_RETURN_ERROR(stream, "wrong wire type");
return pb_dec_varint(stream, field);
case PB_LTYPE_FIXED32:
if (wire_type != PB_WT_32BIT && wire_type != PB_WT_PACKED)
PB_RETURN_ERROR(stream, "wrong wire type");
return pb_decode_fixed32(stream, field->pData);
case PB_LTYPE_FIXED64:
return pb_dec_fixed(stream, field);
if (wire_type != PB_WT_64BIT && wire_type != PB_WT_PACKED)
PB_RETURN_ERROR(stream, "wrong wire type");
#ifdef PB_CONVERT_DOUBLE_FLOAT
if (field->data_size == sizeof(float))
{
return pb_decode_double_as_float(stream, (float*)field->pData);
}
#endif
#ifdef PB_WITHOUT_64BIT
PB_RETURN_ERROR(stream, "invalid data_size");
#else
return pb_decode_fixed64(stream, field->pData);
#endif
case PB_LTYPE_BYTES:
if (wire_type != PB_WT_STRING)
PB_RETURN_ERROR(stream, "wrong wire type");
return pb_dec_bytes(stream, field);
case PB_LTYPE_STRING:
if (wire_type != PB_WT_STRING)
PB_RETURN_ERROR(stream, "wrong wire type");
return pb_dec_string(stream, field);
case PB_LTYPE_SUBMESSAGE:
case PB_LTYPE_SUBMSG_W_CB:
if (wire_type != PB_WT_STRING)
PB_RETURN_ERROR(stream, "wrong wire type");
return pb_dec_submessage(stream, field);
case PB_LTYPE_FIXED_LENGTH_BYTES:
if (wire_type != PB_WT_STRING)
PB_RETURN_ERROR(stream, "wrong wire type");
return pb_dec_fixed_length_bytes(stream, field);
default:
@@ -455,18 +466,12 @@ static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t
switch (PB_HTYPE(field->type))
{
case PB_HTYPE_REQUIRED:
if (!check_wire_type(wire_type, field))
PB_RETURN_ERROR(stream, "wrong wire type");
return decode_basic_field(stream, field);
return decode_basic_field(stream, wire_type, field);
case PB_HTYPE_OPTIONAL:
if (!check_wire_type(wire_type, field))
PB_RETURN_ERROR(stream, "wrong wire type");
if (field->pSize != NULL)
*(bool*)field->pSize = true;
return decode_basic_field(stream, field);
return decode_basic_field(stream, wire_type, field);
case PB_HTYPE_REPEATED:
if (wire_type == PB_WT_STRING
@@ -483,7 +488,7 @@ static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t
while (substream.bytes_left > 0 && *size < field->array_size)
{
if (!decode_basic_field(&substream, field))
if (!decode_basic_field(&substream, PB_WT_PACKED, field))
{
status = false;
break;
@@ -505,18 +510,15 @@ static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t
pb_size_t *size = (pb_size_t*)field->pSize;
field->pData = (char*)field->pField + field->data_size * (*size);
if (!check_wire_type(wire_type, field))
PB_RETURN_ERROR(stream, "wrong wire type");
if ((*size)++ >= field->array_size)
PB_RETURN_ERROR(stream, "array overflow");
return decode_basic_field(stream, field);
return decode_basic_field(stream, wire_type, field);
}
case PB_HTYPE_ONEOF:
*(pb_size_t*)field->pSize = field->tag;
if (PB_LTYPE_IS_SUBMSG(field->type))
if (PB_LTYPE_IS_SUBMSG(field->type) &&
*(pb_size_t*)field->pSize != field->tag)
{
/* We memset to zero so that any callbacks are set to NULL.
* This is because the callbacks might otherwise have values
@@ -526,12 +528,14 @@ static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t
* that can set the fields before submessage is decoded.
* pb_dec_submessage() will set any default values. */
memset(field->pData, 0, (size_t)field->data_size);
/* Set default values for the submessage fields. */
if (!pb_field_set_to_default(field))
PB_RETURN_ERROR(stream, "failed to set defaults");
}
*(pb_size_t*)field->pSize = field->tag;
if (!check_wire_type(wire_type, field))
PB_RETURN_ERROR(stream, "wrong wire type");
return decode_basic_field(stream, field);
return decode_basic_field(stream, wire_type, field);
default:
PB_RETURN_ERROR(stream, "invalid field type");
@@ -599,14 +603,8 @@ static void initialize_pointer_field(void *pItem, pb_field_iter_t *field)
else if (PB_LTYPE_IS_SUBMSG(field->type))
{
/* We memset to zero so that any callbacks are set to NULL.
* Then set any default values. */
pb_field_iter_t submsg_iter;
* Default values will be set by pb_dec_submessage(). */
memset(pItem, 0, field->data_size);
if (pb_field_iter_begin(&submsg_iter, field->submsg_desc, pItem))
{
(void)pb_message_set_to_defaults(&submsg_iter);
}
}
}
#endif
@@ -623,9 +621,6 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
case PB_HTYPE_REQUIRED:
case PB_HTYPE_OPTIONAL:
case PB_HTYPE_ONEOF:
if (!check_wire_type(wire_type, field))
PB_RETURN_ERROR(stream, "wrong wire type");
if (PB_LTYPE_IS_SUBMSG(field->type) && *(void**)field->pField != NULL)
{
/* Duplicate field, have to release the old allocation first. */
@@ -643,7 +638,7 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
{
/* pb_dec_string and pb_dec_bytes handle allocation themselves */
field->pData = field->pField;
return decode_basic_field(stream, field);
return decode_basic_field(stream, wire_type, field);
}
else
{
@@ -652,7 +647,7 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
field->pData = *(void**)field->pField;
initialize_pointer_field(field->pData, field);
return decode_basic_field(stream, field);
return decode_basic_field(stream, wire_type, field);
}
case PB_HTYPE_REPEATED:
@@ -700,7 +695,7 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
/* Decode the array entry */
field->pData = *(char**)field->pField + field->data_size * (*size);
initialize_pointer_field(field->pData, field);
if (!decode_basic_field(&substream, field))
if (!decode_basic_field(&substream, PB_WT_PACKED, field))
{
status = false;
break;
@@ -721,16 +716,13 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
if (*size == PB_SIZE_MAX)
PB_RETURN_ERROR(stream, "too many array entries");
if (!check_wire_type(wire_type, field))
PB_RETURN_ERROR(stream, "wrong wire type");
if (!allocate_field(stream, field->pField, field->data_size, (size_t)(*size + 1)))
return false;
field->pData = *(char**)field->pField + field->data_size * (*size);
(*size)++;
initialize_pointer_field(field->pData, field);
return decode_basic_field(stream, field);
return decode_basic_field(stream, wire_type, field);
}
default:
@@ -821,7 +813,7 @@ static bool checkreturn default_extension_decoder(pb_istream_t *stream,
if (!pb_field_iter_begin_extension(&iter, extension))
PB_RETURN_ERROR(stream, "invalid extension");
if (iter.tag != tag)
if (iter.tag != tag || !iter.message)
return true;
extension->found = true;
@@ -831,9 +823,8 @@ static bool checkreturn default_extension_decoder(pb_istream_t *stream,
/* Try to decode an unknown field as an extension field. Tries each extension
* decoder in turn, until one of them handles the field or loop ends. */
static bool checkreturn decode_extension(pb_istream_t *stream,
uint32_t tag, pb_wire_type_t wire_type, pb_field_iter_t *iter)
uint32_t tag, pb_wire_type_t wire_type, pb_extension_t *extension)
{
pb_extension_t *extension = *(pb_extension_t* const *)iter->pData;
size_t pos = stream->bytes_left;
while (extension != NULL && pos == stream->bytes_left)
@@ -853,22 +844,6 @@ static bool checkreturn decode_extension(pb_istream_t *stream,
return true;
}
/* Step through the iterator until an extension field is found or until all
* entries have been checked. There can be only one extension field per
* message. Returns false if no extension field is found. */
static bool checkreturn find_extension_field(pb_field_iter_t *iter)
{
pb_size_t start = iter->index;
do {
if (PB_LTYPE(iter->type) == PB_LTYPE_EXTENSION)
return true;
(void)pb_field_iter_next(iter);
} while (iter->index != start);
return false;
}
/* Initialize message fields to default values, recursively */
static bool pb_field_set_to_default(pb_field_iter_t *field)
{
@@ -910,9 +885,14 @@ static bool pb_field_set_to_default(pb_field_iter_t *field)
if (init_data)
{
if (PB_LTYPE_IS_SUBMSG(field->type))
if (PB_LTYPE_IS_SUBMSG(field->type) &&
(field->submsg_desc->default_value != NULL ||
field->submsg_desc->field_callback != NULL ||
field->submsg_desc->submsg_info[0] != NULL))
{
/* Initialize submessage to defaults */
/* Initialize submessage to defaults.
* Only needed if it has default values
* or callback/submessage fields. */
pb_field_iter_t submsg_iter;
if (pb_field_iter_begin(&submsg_iter, field->submsg_desc, field->pData))
{
@@ -989,6 +969,7 @@ static bool pb_message_set_to_defaults(pb_field_iter_t *iter)
static bool checkreturn pb_decode_inner(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct, unsigned int flags)
{
uint32_t extension_range_start = 0;
pb_extension_t *extensions = NULL;
/* 'fixed_count_field' and 'fixed_count_size' track position of a repeated fixed
* count field. This can only handle _one_ repeated fixed count field that
@@ -1040,25 +1021,31 @@ static bool checkreturn pb_decode_inner(pb_istream_t *stream, const pb_msgdesc_t
if (!pb_field_iter_find(&iter, tag) || PB_LTYPE(iter.type) == PB_LTYPE_EXTENSION)
{
/* No match found, check if it matches an extension. */
if (extension_range_start == 0)
{
if (pb_field_iter_find_extension(&iter))
{
extensions = *(pb_extension_t* const *)iter.pData;
extension_range_start = iter.tag;
}
if (!extensions)
{
extension_range_start = (uint32_t)-1;
}
}
if (tag >= extension_range_start)
{
if (!find_extension_field(&iter))
extension_range_start = (uint32_t)-1;
else
extension_range_start = iter.tag;
size_t pos = stream->bytes_left;
if (tag >= extension_range_start)
if (!decode_extension(stream, tag, wire_type, extensions))
return false;
if (pos != stream->bytes_left)
{
size_t pos = stream->bytes_left;
if (!decode_extension(stream, tag, wire_type, &iter))
return false;
if (pos != stream->bytes_left)
{
/* The field was handled */
continue;
}
/* The field was handled */
continue;
}
}
@@ -1112,27 +1099,15 @@ static bool checkreturn pb_decode_inner(pb_istream_t *stream, const pb_msgdesc_t
/* Check that all required fields were present. */
{
/* First figure out the number of required fields by
* seeking to the end of the field array. Usually we
* are already close to end after decoding.
*/
pb_size_t req_field_count;
pb_type_t last_type;
pb_size_t i;
do {
req_field_count = iter.required_field_index;
last_type = iter.type;
} while (pb_field_iter_next(&iter));
/* Fixup if last field was also required. */
if (PB_HTYPE(last_type) == PB_HTYPE_REQUIRED && iter.tag != 0)
req_field_count++;
if (req_field_count > PB_MAX_REQUIRED_FIELDS)
req_field_count = PB_MAX_REQUIRED_FIELDS;
pb_size_t req_field_count = iter.descriptor->required_field_count;
if (req_field_count > 0)
{
pb_size_t i;
if (req_field_count > PB_MAX_REQUIRED_FIELDS)
req_field_count = PB_MAX_REQUIRED_FIELDS;
/* Check the whole words */
for (i = 0; i < (req_field_count >> 5); i++)
{
@@ -1277,7 +1252,7 @@ static void pb_release_single_field(pb_field_iter_t *field)
if (field->pData)
{
while (count--)
for (; count > 0; count--)
{
pb_release(field->submsg_desc, field->pData);
field->pData = (char*)field->pData + field->data_size;
@@ -1294,7 +1269,7 @@ static void pb_release_single_field(pb_field_iter_t *field)
/* Release entries in repeated string or bytes array */
void **pItem = *(void***)field->pField;
pb_size_t count = *(pb_size_t*)field->pSize;
while (count--)
for (; count > 0; count--)
{
pb_free(*pItem);
*pItem++ = NULL;
@@ -1454,7 +1429,7 @@ static bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_iter_
/* See issue 97: Google's C++ protobuf allows negative varint values to
* be cast as int32_t, instead of the int64_t that should be used when
* encoding. Previous nanopb versions had a bug in encoding. In order to
* encoding. Nanopb versions before 0.2.5 had a bug in encoding. In order to
* not break decoding of such messages, we cast <=32 bit fields to
* int32_t first to get the sign correct.
*/
@@ -1483,31 +1458,6 @@ static bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_iter_
}
}
static bool checkreturn pb_dec_fixed(pb_istream_t *stream, const pb_field_iter_t *field)
{
#ifdef PB_CONVERT_DOUBLE_FLOAT
if (field->data_size == sizeof(float) && PB_LTYPE(field->type) == PB_LTYPE_FIXED64)
{
return pb_decode_double_as_float(stream, (float*)field->pData);
}
#endif
if (field->data_size == sizeof(uint32_t))
{
return pb_decode_fixed32(stream, field->pData);
}
#ifndef PB_WITHOUT_64BIT
else if (field->data_size == sizeof(uint64_t))
{
return pb_decode_fixed64(stream, field->pData);
}
#endif
else
{
PB_RETURN_ERROR(stream, "invalid data_size");
}
}
static bool checkreturn pb_dec_bytes(pb_istream_t *stream, const pb_field_iter_t *field)
{
uint32_t size;
@@ -1601,6 +1551,7 @@ static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_iter_
static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_iter_t *field)
{
bool status = true;
bool submsg_consumed = false;
pb_istream_t substream;
if (!pb_make_string_substream(stream, &substream))
@@ -1609,19 +1560,6 @@ static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_i
if (field->submsg_desc == NULL)
PB_RETURN_ERROR(stream, "invalid field descriptor");
/* New array entries need to be initialized, while required and optional
* submessages have already been initialized in the top-level pb_decode. */
if (PB_HTYPE(field->type) == PB_HTYPE_REPEATED ||
PB_HTYPE(field->type) == PB_HTYPE_ONEOF)
{
pb_field_iter_t submsg_iter;
if (pb_field_iter_begin(&submsg_iter, field->submsg_desc, field->pData))
{
if (!pb_message_set_to_defaults(&submsg_iter))
PB_RETURN_ERROR(stream, "failed to set defaults");
}
}
/* Submessages can have a separate message-level callback that is called
* before decoding the message. Typically it is used to set callback fields
* inside oneofs. */
@@ -1632,13 +1570,28 @@ static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_i
if (callback->funcs.decode)
{
status = callback->funcs.decode(&substream, field, &callback->arg);
if (substream.bytes_left == 0)
{
submsg_consumed = true;
}
}
}
/* Now decode the submessage contents */
if (status)
if (status && !submsg_consumed)
{
status = pb_decode_inner(&substream, field->submsg_desc, field->pData, 0);
unsigned int flags = 0;
/* Static required/optional fields are already initialized by top-level
* pb_decode(), no need to initialize them again. */
if (PB_ATYPE(field->type) == PB_ATYPE_STATIC &&
PB_HTYPE(field->type) != PB_HTYPE_REPEATED)
{
flags = PB_DECODE_NOINIT;
}
status = pb_decode_inner(&substream, field->submsg_desc, field->pData, flags);
}
if (!pb_close_string_substream(stream, &substream))
@@ -1692,37 +1645,41 @@ bool pb_decode_double_as_float(pb_istream_t *stream, float *dest)
{
/* Special value */
exponent = 128;
}
else if (exponent > 127)
{
/* Too large, convert to infinity */
exponent = 128;
mantissa = 0;
}
else if (exponent < -150)
{
/* Too small, convert to zero */
exponent = -127;
mantissa = 0;
}
else if (exponent < -126)
{
/* Denormalized */
mantissa |= 0x1000000;
mantissa >>= (-126 - exponent);
exponent = -127;
}
/* Round off mantissa */
mantissa = (mantissa + 1) >> 1;
/* Check if mantissa went over 2.0 */
if (mantissa & 0x800000)
{
exponent += 1;
mantissa &= 0x7FFFFF;
mantissa >>= 1;
}
else
{
if (exponent > 127)
{
/* Too large, convert to infinity */
exponent = 128;
mantissa = 0;
}
else if (exponent < -150)
{
/* Too small, convert to zero */
exponent = -127;
mantissa = 0;
}
else if (exponent < -126)
{
/* Denormalized */
mantissa |= 0x1000000;
mantissa >>= (-126 - exponent);
exponent = -127;
}
/* Round off mantissa */
mantissa = (mantissa + 1) >> 1;
/* Check if mantissa went over 2.0 */
if (mantissa & 0x800000)
{
exponent += 1;
mantissa &= 0x7FFFFF;
mantissa >>= 1;
}
}
/* Combine fields */
out.i = mantissa;

View File

@@ -82,8 +82,11 @@ bool checkreturn pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t cou
{
if (count > 0 && stream->callback != NULL)
{
if (stream->bytes_written + count > stream->max_size)
if (stream->bytes_written + count < stream->bytes_written ||
stream->bytes_written + count > stream->max_size)
{
PB_RETURN_ERROR(stream, "stream full");
}
#ifdef PB_BUFFER_ONLY
if (!buf_write(stream, buf, count))
@@ -262,9 +265,33 @@ static bool checkreturn pb_check_proto3_default_value(const pb_field_iter_t *fie
* submessage fields. */
return safe_read_bool(field->pSize) == false;
}
else if (field->descriptor->default_value)
{
/* Proto3 messages do not have default values, but proto2 messages
* can contain optional fields without has_fields (generator option 'proto3').
* In this case they must always be encoded, to make sure that the
* non-zero default value is overwritten.
*/
return false;
}
/* Rest is proto3 singular fields */
if (PB_LTYPE(type) == PB_LTYPE_BYTES)
if (PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE)
{
/* Simple integer / float fields */
pb_size_t i;
const char *p = (const char*)field->pData;
for (i = 0; i < field->data_size; i++)
{
if (p[i] != 0)
{
return false;
}
}
return true;
}
else if (PB_LTYPE(type) == PB_LTYPE_BYTES)
{
const pb_bytes_array_t *bytes = (const pb_bytes_array_t*)field->pData;
return bytes->size == 0;
@@ -302,27 +329,29 @@ static bool checkreturn pb_check_proto3_default_value(const pb_field_iter_t *fie
return true;
}
}
else if (PB_ATYPE(type) == PB_ATYPE_POINTER)
{
/* Catch-all branch that does byte-per-byte comparison for zero value.
*
* This is for all pointer fields, and for static PB_LTYPE_VARINT,
* UVARINT, SVARINT, FIXED32, FIXED64, EXTENSION fields, and also
* callback fields. These all have integer or pointer value which
* can be compared with 0.
*/
pb_size_t i;
const char *p = (const char*)field->pData;
for (i = 0; i < field->data_size; i++)
{
if (p[i] != 0)
{
return false;
}
}
return true;
return field->pData == NULL;
}
else if (PB_ATYPE(type) == PB_ATYPE_CALLBACK)
{
if (PB_LTYPE(type) == PB_LTYPE_EXTENSION)
{
const pb_extension_t *extension = *(const pb_extension_t* const *)field->pData;
return extension == NULL;
}
else if (field->descriptor->field_callback == pb_default_field_callback)
{
pb_callback_t *pCallback = (pb_callback_t*)field->pData;
return pCallback->funcs.encode == NULL;
}
else
{
return field->descriptor->field_callback == NULL;
}
}
return false; /* Not typically reached, safe default for weird special cases. */
}
/* Encode a field with static or pointer allocation, i.e. one whose data
@@ -823,7 +852,7 @@ static bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_iter_t
}
if (PB_ATYPE(field->type) == PB_ATYPE_STATIC &&
PB_BYTES_ARRAY_T_ALLOCSIZE(bytes->size) > field->data_size)
bytes->size > field->data_size - offsetof(pb_bytes_array_t, bytes))
{
PB_RETURN_ERROR(stream, "bytes size exceeded");
}

View File

@@ -0,0 +1,18 @@
/* This section is only included if CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY
is set, to link some sections to BSS in PSRAM */
SECTIONS
{
/* external memory bss, from any global variable with EXT_RAM_ATTR attribute*/
.ext_ram.bss (NOLOAD) :
{
_ext_ram_bss_start = ABSOLUTE(.);
*(.ext_ram.bss*)
*libnet80211.a:(.dynsbss .sbss .sbss.* .gnu.linkonce.sb.* .scommon .sbss2.* .gnu.linkonce.sb2.* .dynbss .bss .bss.* .share.mem .gnu.linkonce.b.* COMMON)
*libpp.a:(.dynsbss .sbss .sbss.* .gnu.linkonce.sb.* .scommon .sbss2.* .gnu.linkonce.sb2.* .dynbss .bss .bss.* .share.mem .gnu.linkonce.b.* COMMON)
*liblwip.a:(.dynsbss .sbss .sbss.* .gnu.linkonce.sb.* .scommon .sbss2.* .gnu.linkonce.sb2.* .dynbss .bss .bss.* .share.mem .gnu.linkonce.b.* COMMON)
*libbt.a:(EXCLUDE_FILE (libbtdm_app.a) .dynsbss .sbss .sbss.* .gnu.linkonce.sb.* .scommon .sbss2.* .gnu.linkonce.sb2.* .dynbss .bss .bss.* .share.mem .gnu.linkonce.b.* COMMON)
. = ALIGN(4);
_ext_ram_bss_end = ABSOLUTE(.);
} > extern_ram_seg
}

View File

@@ -0,0 +1,46 @@
/* Linker script to configure memory regions.
geeksville: modified this to simulate a nrf52832 but with a sd140 soft device. So I can
see how the memory footprint works on this lower end CPU. Note: to work with sd140 in my bootloader
I need to start ram at 0x6000 (instead of the correct 0x3600 for sd132) - so I have less
RAM available than on a real 832.
*/
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0x6D000 - 0x26000
/* FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xED000 - 0x26000 */
/* SRAM required by S132 depend on
* - Attribute Table Size
* - Vendor UUID count
* - Max ATT MTU
* - Concurrent connection peripheral + central + secure links
* - Event Len, HVN queue, Write CMD queue
*/
/* RAM (rwx) : ORIGIN = 0x20003600, LENGTH = 0x20010000 - 0x20003600 */
RAM (rwx) : ORIGIN = 0x20006000, LENGTH = 0x20010000 - 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"

69
nrf52/ttgo_eink_qpsi.ini Normal file
View File

@@ -0,0 +1,69 @@
; nrfjprog.exe configuration file.
; Note: QSPI flash is mapped into memory at address 0x12000000
[DEFAULT_CONFIGURATION]
; Define the capacity of the flash memory device in bytes. Set to 0 if no external memory device is present in your board.
; MX25R1635F is 16Mbit/2Mbyte
MemSize = 0x200000
; Define the desired ReadMode. Valid options are FASTREAD, READ2O, READ2IO, READ4O and READ4IO
ReadMode = READ2IO
; Define the desired WriteMode. Valid options are PP, PP2O, PP4O and PP4IO
WriteMode = PP
; Define the desired AddressMode. Valid options are BIT24 and BIT32
AddressMode = BIT24
; Define the desired Frequency. Valid options are M2, M4, M8, M16 and M32
Frequency = M16
; Define the desired SPI mode. Valid options are MODE0 and MODE3
SpiMode = MODE0
; Define the desired SckDelay. Valid options are in the range 0 to 255
SckDelay = 0x80
; Define the desired IO level for DIO2 and DIO3 during a custom instruction. Valid options are LEVEL_HIGH and LEVEL_LOW
CustomInstructionIO2Level = LEVEL_LOW
CustomInstructionIO3Level = LEVEL_HIGH
; Define the assigned pins for the QSPI peripheral. Valid options are those existing in your device
CSNPin = 15
CSNPort = 1
SCKPin = 14
SCKPort = 1
DIO0Pin = 12
DIO0Port = 1
DIO1Pin = 13
DIO1Port = 1
;These two pins are not connected, but we must name something
DIO2Pin = 3
DIO2Port = 1
DIO3Pin = 5
DIO3Port = 1
; Define the Index of the Write In Progress (WIP) bit in the status register. Valid options are in the range of 0 to 7.
WIPIndex = 0
; Define page size for commands. Valid sizes are PAGE256 and PAGE512.
PPSize = PAGE256
; Custom instructions to send to the external memory after initialization. Format is instruction code plus data to send in between optional brakets.
; These instructions will be executed each time the qspi peripheral is initiated by nrfjprog.
; To improve execution speed on consecutive interations with QSPI, you can run nrfjprog once with custom initialization, and then comment out the lines below.
; Numbers can be given in decimal, hex (starting with either 0x or 0X) and binary (starting with either 0b or 0B) formats.
; The custom instructions will be executed in the order found.
; This example includes two commands, first a WREN (WRite ENable) and then a WRSR (WRite Satus Register) enabling the Quad Operation and the High Performance
; mode for the MX25R6435F memory present in the nRF52840 DK.
;InitializationCustomInstruction = 0x06
;InitializationCustomInstruction = 0x01, [0x40, 0, 0x2]
; For MX25R1635F on TTGO board, only two data lines are connected
; This example includes two commands, first a WREN (WRite ENable) and then a WRSR (WRite Satus Register) disabling Quad Operation and the High Performance
; mode. For normal operation you might want low power mode instead.
InitializationCustomInstruction = 0x06
InitializationCustomInstruction = 0x01, [0x00, 0, 0x2]

View File

@@ -9,7 +9,8 @@
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = tbeam ; Note: the github actions CI test build can't yet build NRF52 targets
default_envs = tbeam # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
;default_envs = heltec # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here
[common]
; common is not currently used
@@ -17,35 +18,29 @@ default_envs = tbeam ; Note: the github actions CI test build can't yet build NR
; REQUIRED environment variables - if not set the specified default will be sued
; The following environment variables must be set in the shell if you'd like to override them.
; They are used in this ini file as systenv.VARNAME, so in your shell do export "VARNAME=fish"
; HW_VERSION (default US)
; APP_VERSION (default emptystring)
; COUNTRY (default US), i.e. "export COUNTRY=EU865"
; HW_VERSION (default emptystring)
[env]
; customize the partition table
; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
board_build.partitions = partition-table.csv
; note: APP_VERSION now comes from bin/version.json
extra_scripts = bin/platformio-custom.py
; note: we add src to our include search path so that lmic_project_config can override
; FIXME: fix lib/BluetoothOTA dependency back on src/ so we can remove -Isrc
build_flags = -Wno-missing-field-initializers -Isrc -Isrc/mesh -Isrc/gps -Ilib/nanopb/include -Os -Wl,-Map,.pio/build/output.map
-DAXP_DEBUG_PORT=Serial
build_flags = -Wno-missing-field-initializers -Isrc -Isrc/mesh -Isrc/gps -Ilib/nanopb/include -Wl,-Map,.pio/build/output.map
-DHW_VERSION_${sysenv.COUNTRY}
-DAPP_VERSION=${sysenv.APP_VERSION}
-DHW_VERSION=${sysenv.HW_VERSION}
; not needed included in ttgo-t-beam board file
; also to use PSRAM https://docs.platformio.org/en/latest/platforms/espressif32.html#external-ram-psram
; -DBOARD_HAS_PSRAM
; -mfix-esp32-psram-cache-issue
; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
-DUSE_THREAD_NAMES
-DTINYGPSPLUS_OPTION_NO_CUSTOM_FIELDS
; leave this commented out to avoid breaking Windows
;upload_port = /dev/ttyUSB0
;monitor_port = /dev/ttyUSB0
;upload_port = /dev/cu.SLAB_USBtoUART
;monitor_port = /dev/cu.SLAB_USBtoUART
; the default is esptool
; upload_protocol = esp-prog
@@ -66,77 +61,129 @@ debug_tool = jlink
lib_deps =
https://github.com/meshtastic/esp8266-oled-ssd1306.git ; ESP8266_SSD1306
SPI
; 1260 ; OneButton - not used yet
https://github.com/geeksville/OneButton.git ; OneButton library for non-blocking button debounce
1202 ; CRC32, explicitly needed because dependency is missing in the ble ota update lib
https://github.com/meshtastic/arduino-fsm.git#2f106146071fc7bc620e1e8d4b88dc4e0266ce39
https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git#31015a55e630a2df77d9d714669c621a5bf355ad
https://github.com/meshtastic/RadioLib.git#8657380241bce681c33aab46598bbf13b11f876c
https://github.com/meshtastic/TinyGPSPlus.git#9c1d584d2469523381e077b0b9c1bf868d6c0206
https://github.com/meshtastic/AXP202X_Library.git#8404abb6d4b486748636bc6ad72d2a47baaf5460
Wire ; explicitly needed here because the AXP202 library forgets to add it
https://github.com/meshtastic/arduino-fsm.git
https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git
https://github.com/meshtastic/RadioLib.git
https://github.com/meshtastic/TinyGPSPlus.git
SPI
https://github.com/geeksville/ArduinoThread.git#333ffd09b596977c217ba25da4258f588b462ac6
; Common settings for conventional (non Portduino) Ardino targets
[arduino_base]
framework = arduino
lib_deps =
${env.lib_deps}
build_flags = ${env.build_flags} -Os
src_filter = ${env.src_filter} -<portduino/>
; Common settings for ESP targes, mixin with extends = esp32_base
[esp32_base]
extends = arduino_base
platform = espressif32
framework = arduino
src_filter =
${env.src_filter} -<nrf52/>
${arduino_base.src_filter} -<nrf52/>
upload_speed = 921600
debug_init_break = tbreak setup
build_flags =
${env.build_flags} -Wall -Wextra -Isrc/esp32
${arduino_base.build_flags} -Wall -Wextra -Isrc/esp32 -Isrc/esp32-mfix-esp32-psram-cache-issue -lnimble -std=c++11
-DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
-DAXP_DEBUG_PORT=Serial
lib_deps =
${arduino_base.lib_deps}
https://github.com/meshtastic/esp32_https_server.git
# Hmm - this doesn't work yet
# board_build.ldscript = linker/esp32.extram.bss.ld
lib_ignore = segger_rtt
platform_packages =
framework-arduinoespressif32 @ https://github.com/meshtastic/arduino-esp32.git
framework-arduinoespressif32@https://github.com/meshtastic/arduino-esp32.git#2814f110aa618429bdd9a0a2d6a93c55f29f87a6
; The 1.0 release of the TBEAM board
; customize the partition table
; http://docs.platformio.org/en/latest/platforms/espressif32.html#partition-tables
board_build.partitions = partition-table.csv
; not needed included in ttgo-t-beam board file
; also to use PSRAM https://docs.platformio.org/en/latest/platforms/espressif32.html#external-ram-psram
; -DBOARD_HAS_PSRAM
; -mfix-esp32-psram-cache-issue
; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
; The 1.0 release of the TBEAM board
[env:tbeam]
extends = esp32_base
board = ttgo-t-beam
lib_deps =
${env.lib_deps}
https://github.com/meshtastic/AXP202X_Library.git
${esp32_base.lib_deps}
build_flags =
${esp32_base.build_flags} -D TBEAM_V10
; The original TBEAM board without the AXP power chip and a few other changes
; Note: I've heard reports this didn't work. Disabled until someone with a 0.7 can test and debug.
;[env:tbeam0.7]
;extends = esp32_base
;board = ttgo-t-beam
;build_flags =
; ${esp32_base.build_flags} -D TBEAM_V07
[env:tbeam0.7]
extends = esp32_base
board = ttgo-t-beam
build_flags =
${esp32_base.build_flags} -D TBEAM_V07
[env:heltec]
;build_type = debug ; to make it possible to step through our jtag debugger
extends = esp32_base
board = heltec_wifi_lora_32_V2
[env:ttgo-lora32-v1]
[env:tlora-v1]
extends = esp32_base
board = ttgo-lora32-v1
build_flags =
${esp32_base.build_flags} -D TTGO_LORA_V1
${esp32_base.build_flags} -D TLORA_V1
; note: the platformio definition for lora32-v2 seems stale, it is missing a pins_arduino.h file, therefore I don't think it works
[env:ttgo-lora32-v2]
[env:tlora-v2]
extends = esp32_base
board = ttgo-lora32-v1
build_flags =
${esp32_base.build_flags} -D TTGO_LORA_V2
${esp32_base.build_flags} -D TLORA_V2
[env:tlora-v2-1-1.6]
extends = esp32_base
board = ttgo-lora32-v1
build_flags =
${esp32_base.build_flags} -D TLORA_V2_1_16
; The Heltec Cubecell plus
; IMPORTANT NOTE: This target doesn't yet work and probably won't ever work. I'm keeping it around for now.
; For more details see my post in the forum.
[env:cubecellplus]
platform = https://github.com/HelTecAutomation/platform-asrmicro650x.git ; we use top-of-tree because stable version has too many bugs - asrmicro650x
board = cubecell_board_plus
; FIXME, bug in cubecell arduino - they are supposed to set ARDUINO
build_flags = ${arduino_base.build_flags} -DARDUINO=100 -Isrc/cubecell
src_filter =
${arduino_base.src_filter} -<esp32/> -<nrf52/>
; Common settings for NRF52 based targets
[nrf52_base]
platform = nordicnrf52
framework = arduino
; Instead of the standard nordicnrf52 platform, we use our fork which has our added variant files
; platform = nordicnrf52
platform = https://github.com/meshtastic/platform-nordicnrf52.git#1a2639a6b0f79b5df66bea3e3089f0d5285fdc63
extends = arduino_base
debug_tool = jlink
build_type = debug ; I'm debugging with ICE a lot now
; note: liboberon provides the AES256 implementation for NRF52 (though not using the hardware acceleration of the NRF52840 - FIXME)
build_flags =
${env.build_flags} -Wno-unused-variable -Isrc/nrf52 -Isdk-nrfxlib/crypto/nrf_oberon/include -Lsdk-nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/ -lliboberon_3.0.3
${arduino_base.build_flags} -Wno-unused-variable
-Isrc/nrf52
-Isdk-nrfxlib/crypto/nrf_oberon/include -Lsdk-nrfxlib/crypto/nrf_oberon/lib/cortex-m4/hard-float/ -lliboberon_3.0.3
;-DCFG_DEBUG=3
src_filter =
${env.src_filter} -<esp32/>
${arduino_base.src_filter} -<esp32/> -<nimble/> -<meshwifi/>
lib_ignore =
BluetoothOTA
monitor_port = /dev/ttyACM1
@@ -153,20 +200,117 @@ debug_init_break =
;debug_init_break = tbreak Reset_Handler
; The NRF52840-dk development board
[env:nrf52dk]
; Note: By default no lora device is created for this build - it uses a simulated interface
[env:nrf52840dk]
extends = nrf52_base
board = nrf52840_dk
; The NRF52840-dk development board, but @geeksville's board - which has a busted oscilliator
[env:nrf52840dk-geeksville]
extends = nrf52_base
board = nrf52840_dk_modified
lib_deps =
UC1701 ; for temp testing
# add our variants files to the include and src paths
build_flags = ${nrf52_base.build_flags} -Ivariants/pca10056-rc-clock
src_filter = ${nrf52_base.src_filter} +<../variants/pca10056-rc-clock>
; Note: By default no lora device is created for this build - it uses a simulated interface
[env:feather_nrf52832]
extends = nrf52_base
board = adafruit_feather_nrf52832
[env:rak815]
extends = nrf52_base
board = rak815
debug_tool = jlink
upload_protocol = jlink
monitor_port = /dev/ttyUSB0
; this board's serial chip can only run at 115200, not faster
monitor_speed = 115200
# For experimenting with RAM sizes
# board_build.ldscript = linker/nrf52840_s140_sim832.ld
; The PPR board
[env:ppr]
extends = nrf52_base
board = ppr
lib_deps =
${env.lib_deps}
${arduino_base.lib_deps}
UC1701
https://github.com/meshtastic/BQ25703A.git
; The PPR board
[env:ppr1]
extends = nrf52_base
board = ppr1
build_flags = ${nrf52_base.build_flags} -Ivariants/ppr1
src_filter = ${nrf52_base.src_filter} +<../variants/ppr1>
lib_deps =
${arduino_base.lib_deps}
; Prototype eink/nrf52840/sx1262 device
[env:eink]
extends = nrf52_base
board = eink
# add our variants files to the include and src paths
# define build flags for the TFT_eSPI library
build_flags = ${nrf52_base.build_flags} -Ivariants/eink
-DBUSY_PIN=3 -DRST_PIN=2 -DDC_PIN=28 -DCS_PIN=30
src_filter = ${nrf52_base.src_filter} +<../variants/eink>
lib_deps =
${arduino_base.lib_deps}
https://github.com/geeksville/EPD_Libraries.git
TFT_eSPI
; The https://github.com/BigCorvus/SX1262-LoRa-BLE-Relay board by @BigCorvus
[env:lora-relay-v1]
extends = nrf52_base
board = lora-relay-v1
# add our variants files to the include and src paths
# define build flags for the TFT_eSPI library
build_flags = ${nrf52_base.build_flags} -Ivariants/lora_relay_v1
-DUSER_SETUP_LOADED
-DTFT_WIDTH=80
-DTFT_HEIGHT=160
-DST7735_GREENTAB160x80
-DST7735_DRIVER
-DTFT_CS=ST7735_CS
-DTFT_DC=ST7735_RS
-DTFT_RST=ST7735_RESET
-DSPI_FREQUENCY=27000000
src_filter = ${nrf52_base.src_filter} +<../variants/lora_relay_v1>
lib_deps =
${arduino_base.lib_deps}
SparkFun BQ27441 LiPo Fuel Gauge Arduino Library
TFT_eSPI
; The https://github.com/BigCorvus/LoRa-BLE-Relay-v2 board by @BigCorvus
[env:lora-relay-v2]
extends = nrf52_base
board = lora-relay-v2
# add our variants files to the include and src paths
# define build flags for the TFT_eSPI library
build_flags = ${nrf52_base.build_flags} -Ivariants/lora_relay_v2
-DUSER_SETUP_LOADED
-DTFT_WIDTH=80
-DTFT_HEIGHT=160
-DST7735_GREENTAB160x80
-DST7735_DRIVER
-DTFT_CS=ST7735_CS
-DTFT_DC=ST7735_RS
-DTFT_RST=ST7735_RESET
-DSPI_FREQUENCY=27000000
-DTFT_WR=ST7735_SDA
-DTFT_SCLK=ST7735_SCK
src_filter = ${nrf52_base.src_filter} +<../variants/lora_relay_v2>
lib_deps =
${arduino_base.lib_deps}
SparkFun BQ27441 LiPo Fuel Gauge Arduino Library
TFT_eSPI
; The Portduino based sim environment on top of linux
[env:linux]
platform = https://github.com/geeksville/platform-portduino.git
src_filter = ${env.src_filter} -<esp32/> -<nimble/> -<nrf52/> -<meshwifi/>
build_flags = ${arduino_base.build_flags} -O0
framework = arduino
board = linux_x86_64

2
proto

Submodule proto updated: e7f181ef6f...75078afe43

3
release/.gitignore vendored
View File

@@ -1,4 +1,5 @@
*.elf
*.bin
*.map
*.zip
*.zip
*.uf2

12
src/BluetoothCommon.cpp Normal file
View File

@@ -0,0 +1,12 @@
#include "BluetoothCommon.h"
// NRF52 wants these constants as byte arrays
// Generated here https://yupana-engineering.com/online-uuid-to-c-array-converter - but in REVERSE BYTE ORDER
const uint8_t MESH_SERVICE_UUID_16[16u] = {0xfd, 0xea, 0x73, 0xe2, 0xca, 0x5d, 0xa8, 0x9f,
0x1f, 0x46, 0xa8, 0x15, 0x18, 0xb2, 0xa1, 0x6b};
const uint8_t TORADIO_UUID_16[16u] = {0xe7, 0x01, 0x44, 0x12, 0x66, 0x78, 0xdd, 0xa1,
0xad, 0x4d, 0x9e, 0x12, 0xd2, 0x76, 0x5c, 0xf7};
const uint8_t FROMRADIO_UUID_16[16u] = {0xd5, 0x54, 0xe4, 0xc5, 0x25, 0xc5, 0x31, 0xa5,
0x55, 0x4a, 0x02, 0xee, 0xc2, 0xbc, 0xa2, 0x8b};
const uint8_t FROMNUM_UUID_16[16u] = {0x53, 0x44, 0xe3, 0x47, 0x75, 0xaa, 0x70, 0xa6,
0x66, 0x4f, 0x00, 0xa8, 0x8c, 0xa1, 0x9d, 0xed};

20
src/BluetoothCommon.h Normal file
View File

@@ -0,0 +1,20 @@
#pragma once
#include <Arduino.h>
/**
* Common lib functions for all platforms that have bluetooth
*/
#define MESH_SERVICE_UUID "6ba1b218-15a8-461f-9fa8-5dcae273eafd"
#define TORADIO_UUID "f75c76d2-129e-4dad-a1dd-7866124401e7"
#define FROMRADIO_UUID "8ba2bcc2-ee02-4a55-a531-c525c5e454d5"
#define FROMNUM_UUID "ed9da18c-a800-4f66-a670-aa7547e34453"
// NRF52 wants these constants as byte arrays
// Generated here https://yupana-engineering.com/online-uuid-to-c-array-converter - but in REVERSE BYTE ORDER
extern const uint8_t MESH_SERVICE_UUID_16[], TORADIO_UUID_16[16u], FROMRADIO_UUID_16[], FROMNUM_UUID_16[];
/// Given a level between 0-100, update the BLE attribute
void updateBatteryLevel(uint8_t level);

21
src/FSCommon.cpp Normal file
View File

@@ -0,0 +1,21 @@
#include "FSCommon.h"
void fsInit()
{
#ifdef FS
if (!FSBegin())
{
DEBUG_MSG("ERROR filesystem mount Failed\n");
assert(0); // FIXME - report failure to phone
}
DEBUG_MSG("Filesystem files:\n");
File dir = FS.open("/");
File f = dir.openNextFile();
while (f) {
DEBUG_MSG(" %s\n", f.name());
f.close();
f = dir.openNextFile();
}
#endif
}

29
src/FSCommon.h Normal file
View File

@@ -0,0 +1,29 @@
#pragma once
#include "configuration.h"
// Cross platform filesystem API
#ifdef PORTDUINO
// Portduino version
#include "PortduinoFS.h"
#define FS PortduinoFS
#define FSBegin() true
#define FILE_O_WRITE "w"
#define FILE_O_READ "r"
#elif !defined(NO_ESP32)
// ESP32 version
#include "SPIFFS.h"
#define FS SPIFFS
#define FSBegin() FS.begin(true)
#define FILE_O_WRITE "w"
#define FILE_O_READ "r"
#else
// NRF52 version
#include "InternalFileSystem.h"
#define FS InternalFS
#define FSBegin() FS.begin()
using namespace Adafruit_LittleFS_Namespace;
#endif
void fsInit();

98
src/GPSStatus.h Normal file
View File

@@ -0,0 +1,98 @@
#pragma once
#include "Status.h"
#include "configuration.h"
#include <Arduino.h>
namespace meshtastic
{
/// Describes the state of the GPS system.
class GPSStatus : public Status
{
private:
CallbackObserver<GPSStatus, const GPSStatus *> statusObserver =
CallbackObserver<GPSStatus, const GPSStatus *>(this, &GPSStatus::updateStatus);
bool hasLock = false; // default to false, until we complete our first read
bool isConnected = false; // Do we have a GPS we are talking to
int32_t latitude = 0, longitude = 0; // as an int mult by 1e-7 to get value as double
int32_t altitude = 0;
uint32_t dop = 0; // Diminution of position; PDOP where possible (UBlox), HDOP otherwise (TinyGPS) in 10^2 units (needs
// scaling before use)
uint32_t heading = 0;
uint32_t numSatellites = 0;
public:
GPSStatus() { statusType = STATUS_TYPE_GPS; }
GPSStatus(bool hasLock, bool isConnected, int32_t latitude, int32_t longitude, int32_t altitude, uint32_t dop,
uint32_t heading, uint32_t numSatellites)
: Status()
{
this->hasLock = hasLock;
this->isConnected = isConnected;
this->latitude = latitude;
this->longitude = longitude;
this->altitude = altitude;
this->dop = dop;
this->heading = heading;
this->numSatellites = numSatellites;
}
GPSStatus(const GPSStatus &);
GPSStatus &operator=(const GPSStatus &);
void observe(Observable<const GPSStatus *> *source) { statusObserver.observe(source); }
bool getHasLock() const { return hasLock; }
bool getIsConnected() const { return isConnected; }
int32_t getLatitude() const { return latitude; }
int32_t getLongitude() const { return longitude; }
int32_t getAltitude() const { return altitude; }
uint32_t getDOP() const { return dop; }
uint32_t getHeading() const { return heading; }
uint32_t getNumSatellites() const { return numSatellites; }
bool matches(const GPSStatus *newStatus) const
{
return (newStatus->hasLock != hasLock || newStatus->isConnected != isConnected || newStatus->latitude != latitude ||
newStatus->longitude != longitude || newStatus->altitude != altitude || newStatus->dop != dop ||
newStatus->heading != heading || newStatus->numSatellites != numSatellites);
}
int updateStatus(const GPSStatus *newStatus)
{
// Only update the status if values have actually changed
bool isDirty;
{
isDirty = matches(newStatus);
initialized = true;
hasLock = newStatus->hasLock;
isConnected = newStatus->isConnected;
latitude = newStatus->latitude;
longitude = newStatus->longitude;
altitude = newStatus->altitude;
dop = newStatus->dop;
heading = newStatus->heading;
numSatellites = newStatus->numSatellites;
}
if (isDirty) {
if (hasLock)
DEBUG_MSG("New GPS pos lat=%f, lon=%f, alt=%d, pdop=%f, heading=%f, sats=%d\n", latitude * 1e-7, longitude * 1e-7,
altitude, dop * 1e-2, heading * 1e-5, numSatellites);
else
DEBUG_MSG("No GPS lock\n");
onNewStatus.notifyObservers(this);
}
return 0;
}
};
} // namespace meshtastic
extern meshtastic::GPSStatus *gpsStatus;

Some files were not shown because too many files have changed in this diff Show More