Compare commits

...

379 Commits

Author SHA1 Message Date
jacobeva
e590dd8b19
Merge pull request #71 from 0x62/fix/neopixel-lora32
Add NeoPixel support for LILYGO LoRa32
2025-04-06 21:09:18 +01:00
jacob.eva
29e78f5dd7
Merge branch 'master' of github.com:liberatedsystems/RNode_Firmware_CE 2025-04-06 20:58:11 +01:00
jacob.eva
40a97a4b61
Re-add E22 to approved models list 2025-04-06 20:57:25 +01:00
jacobeva
3c7f70ceb6
Merge pull request #72 from easytarget/xiao-esp32s3-flash-fix
set correct flash size for Xiao esp32s3
2025-04-06 20:50:40 +01:00
Owen
7f52d475a4 set correct flash size for Xiao esp32s3 2025-03-28 16:38:00 +01:00
0x62
256450272a Add NeoPixel support for LILYGO LoRa32, closes #70 2025-03-27 22:03:12 +00:00
jacob.eva
7342116d91
Added release target for XIAO ESP32 2025-03-19 18:25:26 +00:00
jacob.eva
ea77f3b32e
Add XIAO ESP32S3 support (with Wio-SX1262 and Expansion Base support) 2025-03-19 18:16:41 +00:00
jacob.eva
ffca977752
/ to or 2025-03-07 16:08:53 +00:00
jacob.eva
a4d55d49d1
Fix rendering 2025-03-07 16:08:05 +00:00
jacob.eva
636ae3ca85
Update support devices table 2025-03-07 16:07:16 +00:00
jacob.eva
db5cbe9552
Fix build on non-GPS 2025-02-24 12:05:45 +00:00
jacob.eva
1d79b1e8a9
Add Heltec T114 GPS support and fix T114 FW 2025-02-24 11:22:44 +00:00
jacob.eva
0f29d1b65e
Fix builds 2025-02-12 17:05:19 +00:00
jacob.eva
283d2176bd
Update interfaces 2025-02-12 17:05:03 +00:00
jacob.eva
fc8dd54848
Fix display compilation 2025-02-12 17:04:46 +00:00
jacob.eva
49fb916fd3
Fix board configs for CE 2025-02-12 17:04:25 +00:00
jacob.eva
eaf5f0682f
Update clarification 2025-02-12 17:03:43 +00:00
jacob.eva
06aa6721f8
Ensure interfaces are actually set up 2025-02-12 14:25:02 +00:00
jacob.eva
a39357d332
Fix potential bugs 2025-02-12 14:24:50 +00:00
jacob.eva
1d62fdd52e
Cleanup 2025-02-11 18:26:26 +00:00
jacob.eva
accb5d907c
Use new modem TX IRQ functions 2025-02-11 18:25:37 +00:00
jacob.eva
e9660ae595
Add new modem TX IRQ handling 2025-02-11 18:24:13 +00:00
jacob.eva
20b51104a1
Increase timeout multiplier and fix an SX1280 TX bug 2025-02-11 18:22:43 +00:00
jacob.eva
b1ef85a726
Add logging functionality 2025-02-11 18:22:12 +00:00
jacob.eva
f175582181
Fix incorrect buffer length 2025-02-11 18:19:36 +00:00
jacob.eva
c75cfbf7c7
Cleanup 2025-02-11 18:18:58 +00:00
jacob.eva
659fb2bc14
Update console activation instructions 2025-02-10 14:07:44 +00:00
jacob.eva
337af957e1
Fix TX display functionality on multiple interfaces 2025-02-10 14:06:41 +00:00
jacob.eva
9871a65d50
Remove debug statement 2025-02-10 14:06:08 +00:00
jacob.eva
821e8d47e9
Fix console build and create new image 2025-02-10 14:04:57 +00:00
jacob.eva
211194ee6b
Whoops! 2025-02-06 15:35:04 +00:00
jacob.eva
a7e4174c72
Show RNode ID on display, closes #21 2025-02-04 15:34:39 +00:00
jacob.eva
f9846bd930
Cleanup 2025-02-04 15:33:15 +00:00
jacob.eva
02c8489721
Fix T3S3 compilation 2025-02-04 15:32:56 +00:00
jacob.eva
dfa1d8d066
Remove duplicate value 2025-02-04 15:32:28 +00:00
jacob.eva
0c1342257d
Add reset functions + default bandwidth for SX127X 2025-02-04 15:31:27 +00:00
jacob.eva
dbfa86d803
Enable OLED for Heltec32 v3 2025-02-04 15:31:05 +00:00
jacob.eva
2919bb9aed
Update LoRa32 v2_1 board config 2025-02-04 15:30:31 +00:00
jacob.eva
5ed1ee471a
Cleanup 2025-02-04 15:30:02 +00:00
jacob.eva
c3667d30e3
Update T3S3 board config 2025-02-04 15:29:21 +00:00
jacob.eva
430a0ae4af
Add additional display types 2025-02-04 15:28:28 +00:00
jacob.eva
507e7cdd48
Fix T-Echo build 2025-02-03 17:43:08 +00:00
jacob.eva
31b5e0f0ea
Merge upstream into dev 2025-02-03 17:25:02 +00:00
jacob.eva
245434b9fd
Revamp NRF52 BLE pairing to resemble ESP32 2025-01-30 16:42:56 +00:00
Mark Qvist
e230c73ee0 Updated console build 2025-01-19 22:14:15 +01:00
Mark Qvist
6bbcaa0ba9 Report battery percentage over BLE battery service 2025-01-18 15:20:58 +01:00
Mark Qvist
9473b9df82 Updated readme 2025-01-18 13:12:02 +01:00
Mark Qvist
2ee0e4eb13 Updated console build 2025-01-17 17:25:24 +01:00
Mark Qvist
926e32ec99 Updated console build 2025-01-17 17:04:27 +01:00
Mark Qvist
16090f73e4 Updated readme 2025-01-17 14:38:55 +01:00
Mark Qvist
919bddb703 Cleanup 2025-01-17 10:44:46 +01:00
Mark Qvist
458e40ce9a SX1262 register hang debug 2025-01-17 10:44:16 +01:00
Mark Qvist
3ae8982e93 False preamble detection on SX1262 2025-01-16 23:33:49 +01:00
Mark Qvist
4bdd30daac Cleanup 2025-01-16 23:15:17 +01:00
Mark Qvist
49d023379f Work around for SX1280 modem RSSI status latch on invalid preamble lengths 2025-01-16 23:01:46 +01:00
Mark Qvist
01a27cfd9b Display sleep on T-Echo 2025-01-16 12:20:01 +01:00
Mark Qvist
48bce4ea15 Actually, use SPIM3 for SX1262 on T-Echo 2025-01-16 12:19:38 +01:00
Mark Qvist
3379217e19 Sensible e-ink backlight default 2025-01-16 11:15:31 +01:00
Mark Qvist
9b792862b9 Improved T-Echo e-ink sleep 2025-01-16 11:00:39 +01:00
Mark Qvist
68349aaa70 Fixed T-Echo build paths 2025-01-16 10:19:34 +01:00
Mark Qvist
3e98ea14d2 Fixed T-Echo build paths 2025-01-16 09:46:30 +01:00
Mark Qvist
01e346f21f Added T-Echo to release 2025-01-15 23:57:38 +01:00
Mark Qvist
3fab6d4cdb Blank T-Echo display on sleep 2025-01-15 21:43:13 +01:00
Mark Qvist
ebf5b54957 Power init for T-Echo 2025-01-15 21:20:43 +01:00
Mark Qvist
4e627d6e6b Implemented backlight control and display blanking for T-Echo 2025-01-15 21:19:58 +01:00
Mark Qvist
113b2f1081 Battery management for T-Echo 2025-01-15 21:18:52 +01:00
Mark Qvist
733a792d72 Don't use SPIM3 for LoRa on T-Echo 2025-01-15 21:11:19 +01:00
Mark Qvist
ea33f0cba7 T-Echo pin definitions 2025-01-15 21:10:01 +01:00
Mark Qvist
7066b4de6f Fixed single-byte configuration changes not working on nRF 2025-01-15 21:09:30 +01:00
Mark Qvist
6b815c47d4 LED config on T-Echo 2025-01-15 21:00:02 +01:00
Mark Qvist
f447998c35 Initial T-Echo support 2025-01-15 18:38:34 +01:00
Mark Qvist
2d2d90847a Initial T-Echo support 2025-01-15 18:38:14 +01:00
Mark Qvist
13266c96db Cleanup 2025-01-15 14:03:35 +01:00
Mark Qvist
7e30648968 Fixed nRF52 soft-brick on device EEPROM wipe 2025-01-15 12:42:24 +01:00
Mark Qvist
32fc5afee2 Added missing config graphic 2025-01-15 12:41:15 +01:00
Mark Qvist
3073677b82 Added sleep and wake support on T114 2025-01-15 11:01:26 +01:00
Mark Qvist
2119d381b3 Refactored T3S3 board name variable 2025-01-15 10:21:15 +01:00
Mark Qvist
cbe95b10d6 Fixed incorrect display initialisation on T114 causing display noise on startup 2025-01-15 10:20:25 +01:00
Mark Qvist
6f0c849cb3 Fixed missing check in interference avoidance 2025-01-13 21:12:39 +01:00
Mark Qvist
6eaacb7f99 Cleanup 2025-01-13 20:06:51 +01:00
Mark Qvist
8cf6e9cb40 Added battery support to Heltec T114 2025-01-13 18:05:35 +01:00
Mark Qvist
7a505f73e3 Added signalling of detected interference. Added channel stats output on nRF. 2025-01-13 17:02:07 +01:00
Mark Qvist
b4b1d13dc9 Cleanup 2025-01-13 11:38:17 +01:00
Mark Qvist
becc3d0e3d Implemented display rotation on Heltec T114 2025-01-13 11:37:46 +01:00
Mark Qvist
95895f3756 Set firmware hashes on nRF 2025-01-13 11:37:29 +01:00
Mark Qvist
c1b3b4f416 Updated version 2025-01-13 11:36:42 +01:00
Mark Qvist
62cd3977c7 Added modified ST7789 driver for Heltec T114 2025-01-13 11:36:28 +01:00
jacob.eva
d2c0d53bdd
Fix final SX127X modulation parameter issues #39 2025-01-10 21:31:03 +00:00
jacob.eva
46a46b4069
Revert radiolib work and fix SX127X issues #39 2025-01-09 21:26:58 +00:00
Mark Qvist
7235fa6c3f Updated readme 2025-01-09 21:00:02 +01:00
Mark Qvist
7720fa5192 Updated readme 2025-01-09 20:57:41 +01:00
Mark Qvist
d0041281bd Updated release 2025-01-09 20:49:22 +01:00
Mark Qvist
71e73580f7 Cleanup 2025-01-09 18:41:35 +01:00
Mark Qvist
6e7370acdc Added interference avoidance option 2025-01-09 17:58:46 +01:00
Mark Qvist
434f55b240 Increased noise floor samples 2025-01-09 15:00:06 +01:00
Mark Qvist
06b4fba603 Added noise floor monitoring and reporting to host 2025-01-09 14:46:13 +01:00
Mark Qvist
c5ed792280 Scale waterfall dynamic range depending on band 2025-01-09 14:44:49 +01:00
Mark Qvist
5671cd7288 Typing 2025-01-09 12:54:57 +01:00
Mark Qvist
f466cabe61 Cleanup 2025-01-09 00:37:39 +01:00
Mark Qvist
8b8502e8e0 Cleanup 2025-01-09 00:34:22 +01:00
Mark Qvist
dbebb4080a Cleanup 2025-01-09 00:28:18 +01:00
Mark Qvist
7adc3e2a0d Cleanup 2025-01-09 00:13:27 +01:00
Mark Qvist
218a38adb7 Optimise packet handling for SX1280 fast data rates 2025-01-09 00:01:49 +01:00
Mark Qvist
729a4099e5 Correct invalid IRQ index for SX1280 2025-01-08 22:16:07 +01:00
Mark Qvist
9c7a04b66c Always use external crystal oscillator on SX1280 2025-01-08 21:26:37 +01:00
Mark Qvist
2b93b1b9e7 SX1280 parameter modifications 2025-01-08 20:58:12 +01:00
Mark Qvist
58f6a3d6a3 Reworked DCD methods for SX1276 and SX1280 2025-01-08 17:45:23 +01:00
Mark Qvist
a796e56dd9 Cleanup 2025-01-08 17:44:30 +01:00
Mark Qvist
aa7bb49b30 Cleanup 2025-01-08 16:52:50 +01:00
Mark Qvist
254225e917 Cleanup 2025-01-08 16:50:29 +01:00
Mark Qvist
ae47b89b53 Added banded contention window allocation 2025-01-08 16:46:16 +01:00
Mark Qvist
498652f583 Added CSMA stats command to host 2025-01-08 16:44:33 +01:00
Mark Qvist
c04067446d Configuration parameters for new CSMA scheme 2025-01-08 16:44:06 +01:00
Mark Qvist
4ab42c4269 Cleanup 2025-01-07 20:43:15 +01:00
Mark Qvist
7ce2ed6155 Cleanup 2025-01-07 20:33:20 +01:00
Mark Qvist
5ec063c939 Reworked CSMA algorithm 2025-01-07 20:15:26 +01:00
Mark Qvist
08651f92f7 Reworked SX1262 LoRa carrier detection 2025-01-07 15:14:44 +01:00
Mark Qvist
e40532ed35 Revert min preamble symbols 2025-01-06 14:21:09 +01:00
Mark Qvist
1dab538d8f Updated console image 2025-01-06 14:20:45 +01:00
Mark Qvist
c39164e272 Accurate preamble and airtime calculations on SX1280. Fix airtime calculation on SX1262 when LDRO is enabled. 2025-01-05 22:55:32 +01:00
Mark Qvist
b667e825f8 Cleanup 2025-01-05 22:47:28 +01:00
Mark Qvist
0545847e40 Cleanup 2025-01-05 21:05:51 +01:00
Mark Qvist
df6463144f Temporarily disabled Heltec T114 from release artifacts 2025-01-05 16:07:32 +01:00
Mark Qvist
42be6640de Updated issue template 2025-01-05 16:06:37 +01:00
Mark Qvist
01fcaadea5 Heltec T114 build config 2025-01-05 15:50:29 +01:00
Mark Qvist
bc9ce056ee Add Heltec T114 to release artifacts 2025-01-05 15:05:49 +01:00
Mark Qvist
0057852b6c Battery management for T3S3 2025-01-05 14:53:28 +01:00
Mark Qvist
b7b9fb0c04 Battery management for T3S3 2025-01-05 12:03:27 +01:00
Mark Qvist
564e2f26f3 Fixed intermittent radio init failure on T3S3 SX1280 2025-01-04 22:08:04 +01:00
Mark Qvist
9ba243ee1f Fixed intermittent radio init failure on T3S3 SX1280 2025-01-04 22:07:43 +01:00
Mark Qvist
eb168d4734 Cleanup 2025-01-04 21:05:11 +01:00
Mark Qvist
217db4bcd3 Update release builds to include T3S3 SX1280 PA 2025-01-04 20:20:35 +01:00
Mark Qvist
b9cd4d7751 Update version 2025-01-03 21:59:20 +01:00
Mark Qvist
b02989e07a Cleanup 2025-01-03 21:58:59 +01:00
Mark Qvist
b891932353 Add T3S3 SX1280 PA release 2025-01-03 21:58:43 +01:00
Mark Qvist
35a4b6ff4e Added support for T3S3 SX1280 2025-01-03 21:23:23 +01:00
Mark Qvist
4e251cd186 T3S3 SX1280 model codes 2025-01-03 21:22:37 +01:00
Mark Qvist
a663707a69 Waterfall TX width on SX1280 2025-01-03 21:21:11 +01:00
Mark Qvist
a5a3ca28fa T3S3 SX1280 initial driver support 2025-01-03 19:20:10 +01:00
Mark Qvist
421f2d5db3 Cleanup 2025-01-03 19:16:37 +01:00
Mark Qvist
6bf06ca94e T3S3 SX1280 support 2025-01-03 19:16:19 +01:00
Mark Qvist
315bcb02a0 SX1280 EEPROM checks 2025-01-03 12:52:01 +01:00
Mark Qvist
52fbe558d4 Only scale bitmaps if scaling factor != 1 2025-01-03 12:10:09 +01:00
Mark Qvist
470f4f4d09 Merge branch 'master' of github.com:markqvist/RNode_Firmware 2025-01-03 12:01:33 +01:00
markqvist
653845ad31
Merge pull request #98 from liamcottle/board/heltec-t114
Add support for Heltec T114
2025-01-03 12:01:10 +01:00
Mark Qvist
9174dbd34a Board defines for T3S3-SX1280 2025-01-03 11:54:48 +01:00
liamcottle
abde6561b5 use neopixel on heltec t114 2025-01-02 23:39:54 +13:00
liamcottle
6a43bf51ef remove unused rx switch 2025-01-02 15:28:10 +13:00
liamcottle
f9234733e2 add support for heltec t114 2025-01-02 15:14:18 +13:00
Mark Qvist
6c82de161c Added display reconditioning function 2024-12-31 14:20:43 +01:00
Mark Qvist
571e7d7105 Added display reconditioning function 2024-12-31 14:13:52 +01:00
Mark Qvist
2604b44d64 Added ability to configure display rotation 2024-12-31 13:23:48 +01:00
jacob.eva
734727ebc6
Add LilyGo T3 v1.0 models 2024-12-23 20:45:43 +00:00
Mark Qvist
786c9990fb Updated console image 2024-12-12 12:41:55 +01:00
Mark Qvist
2263b20b81 Set default OCP 2024-12-10 18:42:13 +01:00
Mark Qvist
d599109562 Set default OCP 2024-12-10 16:37:55 +01:00
Mark Qvist
aba9a317dd Set default OCP 2024-12-10 16:05:08 +01:00
Mark Qvist
d88f231332 Added ability to specify per-board transceiver OCP limit 2024-12-10 15:35:29 +01:00
Mark Qvist
d012c37146 Added missing PA output pin configs 2024-12-10 15:34:57 +01:00
Mark Qvist
3e4bb282f8 Updated readme 2024-12-10 00:13:52 +01:00
Mark Qvist
315bc1c037 Updated console image 2024-12-10 00:05:52 +01:00
Mark Qvist
9445fc8992 Updated console build 2024-12-09 23:51:55 +01:00
Mark Qvist
33f7dde92e Updated readme 2024-12-08 14:09:02 +01:00
Mark Qvist
df7410e683 Updated readme 2024-12-08 14:06:09 +01:00
Mark Qvist
9f6f2fc000 Merge branch 'master' of github.com:markqvist/RNode_Firmware 2024-12-08 13:49:23 +01:00
Mark Qvist
4b48f41c38 Added display read command 2024-12-08 13:49:07 +01:00
markqvist
9fdd886d00
Merge pull request #96 from jacobeva/hash-fix
Retrieve firmware image length from bootloader cfg, fix #95
2024-12-07 22:37:03 +01:00
jacob.eva
a28e80f0b3
Retrieve firmware image length from bootloader cfg (nRF52840) 2024-12-07 20:46:01 +00:00
jacob.eva
5ac30b0fa7
Retrieve firmware image length from bootloader cfg, fix #95 2024-12-07 20:39:09 +00:00
jacob.eva
4dbfc15aa0
Fix split packet issue on some boards with SX1280 configured #13 2024-12-06 14:16:55 +00:00
jacob.eva
d9e1f98d86
Correct T3S3 SX1280 buffer size 2024-12-06 14:16:37 +00:00
jacob.eva
0f63ae4fc7
Fix incorrect variable names and add t-echo release target, #41 2024-12-06 11:25:09 +00:00
jacob.eva
59f6224c09
Revert to SX127X TX power value being read directly with an offset #39 2024-12-06 10:58:55 +00:00
jacob.eva
44e69f910a
Merge branch 'dev' of github.com:liberatedsystems/RNode_Firmware_CE into dev 2024-11-11 20:55:02 +00:00
jacob.eva
8013bac0e7
Fix version display error 2024-11-11 20:53:57 +00:00
jacobeva
e446d157c6
Merge pull request #52 from WifiHero91/patch-1
Update Boards.h
2024-10-31 22:21:19 +00:00
WifiHero91
125080b682
Update Makefile
after board.h update needed to fix Makefile
2024-10-26 22:16:02 +02:00
WifiHero91
be4d6a65b7
Update Boards.h
The board numbers collision. This commit fix this and all boards has unique number like 0x43.
2024-10-26 21:59:33 +02:00
markqvist
ead6b41259
Merge pull request #94 from jacobeva/ble-fix
Fix BLE packet corruption on nRF52
2024-10-23 22:07:48 +02:00
jacob.eva
7d3cfed38b
Fix T3S3 init on AB and AC models 2024-10-23 19:32:16 +01:00
jacob.eva
5fbac58550
Increase BLE RX fifo buffer size on nRF52 2024-10-23 17:27:23 +01:00
jacob.eva
1314c42ad3
Fix RX buffer BLE issue for good 2024-10-23 16:44:39 +01:00
jacob.eva
629abbc3c0
openCom XL - Adjust TX power PA curve 2024-10-23 11:15:39 +01:00
jacob.eva
58fdc62722
Enlarge BLE transmission buffer to support split packets 2024-10-23 08:35:11 +01:00
jacob.eva
8207c62d73
Change read_len to array to combat multiple interface edge case 2024-10-22 18:02:46 +01:00
jacob.eva
a4081fd79c
Fix edge case of potential packet duplication 2024-10-22 14:07:23 +01:00
jacob.eva
bf38bbf7b1
Correct version to 1.74 2024-10-22 11:55:58 +01:00
jacob.eva
c4104ce0c7
Add openCom XL upload target 2024-10-16 21:49:45 +01:00
jacob.eva
18780131d8
Fix openCom XL compilation 2024-10-16 21:24:18 +01:00
jacob.eva
17ff4b0496
Update T3S3 SX1280 PA model code, again 2024-10-16 21:23:33 +01:00
jacob.eva
6cb176796f
Fix - correct version to 1.75 2024-10-16 16:59:45 +01:00
jacob.eva
c18ec1629f
Update openCom XL makefile targets 2024-10-16 16:29:59 +01:00
jacob.eva
2930e89a3d
Add openCom XL board definition 2024-10-16 16:28:42 +01:00
jacob.eva
89e37323cc
Ensure instant startup on openCom XL 2024-10-16 16:25:40 +01:00
jacob.eva
a76a01b25f
Bump version to 1.75 2024-10-16 16:17:47 +01:00
jacob.eva
ef80c2638c
Fix BLE service duplication bug on nRF52 2024-10-16 16:15:29 +01:00
jacob.eva
55c6bd06a2
Enable fast preamble and change fast preamble length to 4ms 2024-10-16 16:08:16 +01:00
jacob.eva
7f493a33d3
Remove reference to old variable 2024-10-15 17:43:58 +01:00
jacob.eva
6b4b16bedc
Update T3S3 SX1280 with PA model 2024-10-15 17:36:03 +01:00
jacob.eva
f6fe7e2b5f
Fix buffer overrun and freezing bugs 2024-10-15 17:34:16 +01:00
jacob.eva
858a35b2f9
Store SX127X tx power in variable, attempt to fix #39 2024-10-12 22:26:42 +01:00
jacob.eva
c7e24f7966
Add Heltec LoRa32 v3 to setTXPower 2024-10-12 22:23:50 +01:00
jacob.eva
c4259d9b6c
Change model code for T3S3 SX1280 w/ PA 2024-10-12 22:23:15 +01:00
jacob.eva
bf2ea2ebb4
Limit T3S3 TX power for now 2024-10-12 21:58:58 +01:00
jacob.eva
733b506af9
Correct T3S3 flashing 2024-10-12 21:03:33 +01:00
jacob.eva
745631055d
Correct T3S3 SX1280 PA pins 2024-10-12 21:02:40 +01:00
jacob.eva
264abe62bd
Correct T3S3 SPI configuration 2024-10-12 20:38:56 +01:00
jacob.eva
0bb2e5bcd3
Fix missing --port option 2024-10-12 20:24:32 +01:00
jacob.eva
6c182925b8
Add TXEN and RXEN pins for PA model of T3S3 2024-10-12 18:15:12 +01:00
jacob.eva
1136dcbc53
Update to RNode Firmware v1.78 (upstream) 2024-10-12 18:04:19 +01:00
Mark Qvist
9edc2224e7 Use built-in split-packet check in transmit function 2024-10-12 14:10:33 +02:00
Mark Qvist
7f998e6436 Merge branch 'master' of github.com:markqvist/RNode_Firmware 2024-10-12 14:07:25 +02:00
markqvist
711f9c6eac
Merge pull request #90 from jacobeva/transmit-fix
Improve checks around split packet handling in transmit()
2024-10-12 14:06:56 +02:00
markqvist
707608fd33
Merge pull request #89 from jacobeva/master
Decrease connection interval on BLE to increase throughput
2024-10-12 14:04:13 +02:00
jacob.eva
982a755464
Improve checks around split packet handling in transmit() 2024-10-12 13:00:52 +01:00
jacob.eva
34e872b25d
Decrease connection interval on BLE to increase throughput 2024-10-12 12:55:35 +01:00
jacob.eva
1b443c5971
Fix edge case in transmission handling 2024-10-12 12:45:20 +01:00
jacob.eva
afce928149
Merge t-echo display support (currently non-scaled) 2024-10-11 19:58:36 +01:00
jacob.eva
2be8fa407d
Merge branch 'master' of github.com:liberatedsystems/RNode_Firmware_CE 2024-10-11 19:41:39 +01:00
jacob.eva
4f20c591ec
Merge branch 'make_fixes' 2024-10-11 19:40:26 +01:00
jacob.eva
0aaf722088
Merge 2024-10-11 18:54:40 +01:00
Mark Qvist
a3e15bed1b Updated console image 2024-10-11 17:46:13 +02:00
Mark Qvist
da1207ceee Updated readme 2024-10-11 17:23:31 +02:00
Mark Qvist
12b32b99f9 Updated console image 2024-10-11 17:18:33 +02:00
Mark Qvist
76eaae8554 Cleanup 2024-10-11 16:39:38 +02:00
Mark Qvist
8c0900e2d0 Fixed missing connection handling init 2024-10-11 16:35:21 +02:00
Mark Qvist
389745ad33 Attach packet RSSI and SNR to packet queue entry structs. Disable ISR spinlocks on ESP32 until tested. 2024-10-11 16:29:17 +02:00
markqvist
1de5f3c796
Merge pull request #86 from jacobeva/master
Fix RAK4631 intermittent packet corruption
2024-10-11 14:51:05 +02:00
Mark Qvist
7a8a1b5dee Cleanup 2024-10-11 14:48:42 +02:00
Mark Qvist
c51335a1df Cleanup 2024-10-11 14:46:03 +02:00
Mark Qvist
2e6db2f818 Merge branch 'master' of github.com:markqvist/RNode_Firmware 2024-10-11 14:43:46 +02:00
Mark Qvist
16b06406f2 Changed standby LED color 2024-10-11 14:35:45 +02:00
Mark Qvist
2ab1d4b1ac Gracefully close bluetooth on device sleep 2024-10-11 12:49:02 +02:00
Mark Qvist
335c6cbc5c Updated charge status 2024-10-11 10:21:10 +02:00
Mark Qvist
2ede362cb3 Adjusted CSMA parameters and P-curve. Added dynamic CSMA slot time. 2024-10-10 23:26:12 +02:00
markqvist
1bd7de8f97
Merge pull request #88 from jacobeva/preamble-fix
Fix incorrect SX1280 preamble calculation
2024-10-10 18:00:11 +02:00
markqvist
0e04754d7a
Merge pull request #87 from jacobeva/nrf52-ble
nRF52 BLE improvements
2024-10-10 17:58:37 +02:00
jacob.eva
cb192d47ed
Fix incorrect SX1280 preamble calculation 2024-10-10 14:47:40 +01:00
jacob.eva
03893c2793
nRF52 BLE improvements 2024-10-10 14:40:57 +01:00
jacob.eva
ed04513a7a
Fix RAK4631 intermittent packet corruption 2024-10-10 12:54:36 +01:00
Mark Qvist
8639765679 Updated console build 2024-10-07 22:03:10 +02:00
Mark Qvist
407120265a Updated readme 2024-10-07 21:26:05 +02:00
Mark Qvist
42eb68137d Updated version 2024-10-07 21:19:59 +02:00
Mark Qvist
68008283a2 Add CSMA param 2024-10-07 20:45:28 +02:00
Mark Qvist
22372855b3 Add modem comm timeout error code 2024-10-07 20:45:12 +02:00
Mark Qvist
c55d907045 Add modem comm timeout error code 2024-10-07 20:44:13 +02:00
Mark Qvist
30f92c0f3f Improved BLE pairing 2024-10-07 20:43:53 +02:00
Mark Qvist
d61d14e117 Detect modem communication timeouts for sx126x chips 2024-10-07 20:43:16 +02:00
Mark Qvist
5807cfdb96 Fixed display sleep on T3S3 2024-10-07 18:25:08 +02:00
Mark Qvist
d7511d430e Updated console build 2024-10-06 12:18:54 +02:00
Mark Qvist
ffb951172f Updated console build 2024-10-06 11:46:24 +02:00
Mark Qvist
3fe5affb51 Cleanup 2024-10-05 22:21:38 +02:00
Mark Qvist
94215c4bce Added input button and sleep config to T-Beam and Heltec v2 boards 2024-10-05 22:20:34 +02:00
Mark Qvist
960599c35a Only raise low memory error if heap is actually low 2024-10-05 20:56:49 +02:00
Mark Qvist
bfc215b2a3 Fix T3S3 SX1262 dio pin and build config 2024-10-05 20:55:48 +02:00
Mark Qvist
e8dd7dbc93 Added TX packet display to waterfall 2024-10-05 16:44:44 +02:00
Mark Qvist
9ce280f207 Updated readme 2024-10-05 16:03:47 +02:00
Mark Qvist
1a2e42d93c Use event queue for modem interrupt packet retrieval on ESP32 and nRF52 2024-10-05 15:28:32 +02:00
markqvist
c9f658e966
Merge pull request #82 from liamcottle/feature/rak4631-rak1921-display
Add support for RAK1921 OLED display and User Button on RAK4631 boards
2024-10-05 12:09:31 +02:00
liamcottle
e4deac3060 add support for user button on rak wismesh pocket which uses RAK4630 internally 2024-10-05 19:12:26 +13:00
liamcottle
940262e2c6 set display mode to landscape 2024-10-05 19:09:57 +13:00
liamcottle
49a524e8d5 add support for rak1921 oled display on rak4631 boards 2024-10-05 16:07:22 +13:00
Mark Qvist
e993da9e0f Added RAK4631 to full release build 2024-10-05 03:15:11 +02:00
Mark Qvist
4615765039 Fix compilation for RAK4631 2024-10-05 03:09:47 +02:00
Mark Qvist
15a1d53c61 Updated readme 2024-10-05 02:55:22 +02:00
Mark Qvist
05c337c057 Updated readme 2024-10-05 02:54:11 +02:00
Mark Qvist
a37a03fe3b Updated readme 2024-10-05 02:52:56 +02:00
Mark Qvist
9556f0b91b Added support for T3S3 boards with SX127x modems 2024-10-05 02:47:54 +02:00
Mark Qvist
1ac3a6c2c8 Remove boot-mode/reset requirements for T3S3 flashing 2024-10-05 01:07:44 +02:00
Mark Qvist
6974a50d10 Added T-Beam Supreme support 2024-10-05 00:42:19 +02:00
Mark Qvist
bd887f7de2 Disable T-Deck display until functional 2024-10-03 02:53:11 +02:00
Mark Qvist
fef27b194c Basic T-Deck display support 2024-10-03 02:51:54 +02:00
Mark Qvist
2c93b2a1de Updated console image 2024-10-03 00:53:28 +02:00
Mark Qvist
8bdd85e648 Added T-Deck support 2024-10-03 00:38:49 +02:00
Mark Qvist
bb38290120 Updated console image 2024-10-02 22:25:38 +02:00
Mark Qvist
354d4c83a3 Updated console image 2024-10-02 02:25:58 +02:00
Mark Qvist
f1bb794049 Updated console image 2024-10-02 01:10:17 +02:00
Mark Qvist
5ecbe95980 Display blanking 2024-10-02 01:10:02 +02:00
jacobeva
c6638f1450
Merge pull request #46 from tomuk5/E22_ESP32
ESP32: Ebyte E22 900M30S Board support
2024-10-01 18:51:17 +01:00
Mark Qvist
4a05f51d99 Merge branch 'master' of github.com:markqvist/RNode_Firmware 2024-10-01 18:12:49 +02:00
Mark Qvist
5bd2e539eb Update battery status output on missing battery 2024-10-01 18:07:10 +02:00
Mark Qvist
2804a05afd Update display blanking 2024-10-01 17:51:14 +02:00
Mark Qvist
423098ff30 Updated display blanking/unblanking 2024-10-01 17:40:18 +02:00
jacob.eva
77503dcc1d
Fix interface framing assignment conflict 2024-10-01 15:55:20 +01:00
Mark Qvist
0b9f19916e Improved battery calculations for devices without dedicated PMU 2024-10-01 15:33:03 +02:00
Mark Qvist
96e74246bb Improve button input interactions 2024-10-01 14:59:53 +02:00
Mark Qvist
e5028c88d6 Clear signal bars on BLE device disconnect 2024-10-01 14:58:43 +02:00
Mark Qvist
0f0a711cd7 Improved battery calculations for devices without dedicated PMU 2024-10-01 14:57:57 +02:00
markqvist
c813d27dff
Merge pull request #81 from neutralinsomniac/install_correct_esp32_arduino_version
Makefile: use correct version of arduino esp32 library
2024-09-30 19:42:10 +02:00
Mark Qvist
304cdd2968 Cleanup 2024-09-30 19:18:30 +02:00
Jeremy O'Brien
6b729ebf72 Makefile: use correct version of arduino esp32 library 2024-09-30 10:45:19 -04:00
Mark Qvist
a9a68d164e Only allow BLE modes with MITM mitigations enabled, and require bonding 2024-09-30 13:50:06 +02:00
Mark Qvist
dfd62f4d94 Cleanup 2024-09-30 13:49:40 +02:00
Mark Qvist
491cab09c6 Only allow BLE modes with MITM mitigations enabled, and require bonding 2024-09-30 13:47:29 +02:00
Mark Qvist
6332e95d39 Cleanup 2024-09-30 13:45:58 +02:00
Mark Qvist
e7f655cef5 Update makefile ESP-IDF target to 2.0.17 2024-09-30 13:42:47 +02:00
Mark Qvist
75816b4fe0 Added ESP32 BLE Serial support 2024-09-29 21:59:42 +02:00
Mark Qvist
d742166a12 Cleanup 2024-09-29 21:59:24 +02:00
Mark Qvist
339003039a Added ESP32 BLE serial driver 2024-09-29 21:59:11 +02:00
Mark Qvist
fe9538de7e Cleanup 2024-09-29 11:36:52 +02:00
Mark Qvist
59e1836975 Cleanup 2024-09-29 03:10:32 +02:00
Mark Qvist
a4ecc0d6f3 Added display blanking timeout 2024-09-29 02:33:02 +02:00
Mark Qvist
97806d1684 Cleanup 2024-09-29 01:21:49 +02:00
Mark Qvist
a739d6f3ab Fixed display intensity EEPROM configuration regression 2024-09-29 00:03:14 +02:00
Mark Qvist
bb9f515348 Check console is activated 2024-09-28 15:15:22 +02:00
Mark Qvist
a134cbfb9c Added NeoPixel intensity control 2024-09-27 20:08:05 +02:00
Aaron Bieber
6ed29517c7
Revamp makefile to be more dynamic and reduce much some duplication 2024-09-27 09:20:56 -06:00
Mark Qvist
d2133ba5e0 Added battery status and console support to Heltec V3 2024-09-27 00:28:37 +02:00
Mark Qvist
ac819ecb20 Added input button actions 2024-09-27 00:27:24 +02:00
Mark Qvist
b1d097f6d4 Updated console build 2024-09-25 15:58:34 +02:00
Mark Qvist
50a40ac13b Updated console build 2024-09-25 14:48:13 +02:00
Mark Qvist
9403dd6cc9 Updated version 2024-09-25 14:22:07 +02:00
Mark Qvist
8473073c81 Check ESP32 BT buffer config before building 2024-09-25 14:21:38 +02:00
Mark Qvist
eddad23085 Updated console build 2024-09-25 14:21:12 +02:00
Mark Qvist
3f4468ba95 Updated console build 2024-09-25 14:21:02 +02:00
jacobeva
bed02c9d97
Merge pull request #40 from jeremybox/techo/fix-arduino-build
small make prep fixes
2024-09-16 18:00:42 +01:00
Jeremy
50a60f07d2 fixes adds missing adafruit repo used for prep-nrf, and adds prep-nrf to the make prep 2024-09-16 12:50:56 -04:00
tomuk5
d8af625cc4 E22 Board 2024-09-13 10:08:52 +01:00
jacob.eva
2cdf2951e6
Cleanup 2024-09-12 20:32:54 +01:00
jacobeva
a8af5314b7
Merge pull request #36 from jeremybox/techo
Add t-echo support
2024-09-12 20:22:46 +01:00
jeremybox
83ae40470f
Delete .vscode/settings.json 2024-09-12 11:03:56 -04:00
jeremy
2550b7a379 adds .vscode to git ignore file 2024-09-12 11:02:21 -04:00
jeremy
02f9dc1345 Squashed commit of the following:
commit 2e25bff15413f2365f1b18c901f93297ce07c645
Author: jeremy <jeremy@ubuntu>
Date:   Thu Sep 12 10:19:07 2024 -0400

    Adds t-echo support

commit aa44625847179c5b3c4d03b9f7e062f409da0d8a
Author: jeremy <jeremy@ubuntu>
Date:   Thu Sep 12 10:19:07 2024 -0400

    Adds t-echo support
2024-09-12 10:57:16 -04:00
jacob.eva
07b7e28c74
Allow ESP32 with BLE to compile 2024-09-11 21:49:56 +01:00
jacob.eva
ba9022335c
Well that was embarassing... 2024-09-11 21:49:27 +01:00
jacob.eva
f8299568fb
Replace all references to python with python3 instead, close #33 2024-09-11 21:01:51 +01:00
jacob.eva
51afd310a5
Revert to ISR handling packets and cap SX1280 data rate 2024-09-11 20:18:43 +01:00
tomuk5
c3b5a6f47f
Add custom board signing and EEPROM instructions
Signed-off-by: jacob.eva <x00010@disroot.org>
2024-09-10 22:47:46 +01:00
jacob.eva
638bcfff1a
Correct various lengths and data types 2024-09-10 22:39:49 +01:00
jacob.eva
c3c254cd96
Change interrupt layout and address SX1280 errata 2024-09-10 22:39:15 +01:00
jacob.eva
7f787d5910
Improve BLE serial performance + add BLE battery display 2024-09-10 22:37:26 +01:00
jacob.eva
c9fd5f7d3b
Add support for retrieving packet length on implicit header 2024-09-05 13:10:11 +01:00
jacob.eva
419a5c6ce3
Finish off edge cases of race condition 2024-09-04 21:56:47 +01:00
jacob.eva
cc4010fc95
Correct interface selection logic 2024-09-04 18:25:36 +01:00
jacob.eva
81aff16c2d
Fix race condition on multiple interfaces receiving at once 2024-09-04 17:37:09 +01:00
jacob.eva
6035e1a2c2
Move FIFOBuffer to src dir 2024-09-04 17:35:07 +01:00
jacob.eva
52629cb1bf
Add check for freeNode in RAK4631 power section 2024-09-04 10:18:52 +01:00
jacobeva
3ccdb79b91
Merge pull request #31 from macvenez/makefile-ports
Added Makefile option to use variable "port" to select port to upload or use default one. Closes #26
2024-09-03 16:26:24 +01:00
macvenez
a54a8ed44d Added default port for upload or specified by argument "port" 2024-09-03 15:51:05 +02:00
jacob.eva
06b4683993
Fix BLE pairing state on NRF52 2024-08-31 21:46:07 +01:00
jacob.eva
139cf7e3bf
Merge branch 'master' of github.com:liberatedsystems/RNode_Firmware_CE 2024-08-30 18:21:16 +01:00
jacob.eva
d9cb64ec93
Make screensaver checks more efficient + add periodic refresh to RAK4631 2024-08-30 18:18:56 +01:00
jacobeva
5cb7de66d8
Merge pull request #24 from jeremybox/screensaver
makes SCREENSAVER_INTERVAL a #define to save some ram
2024-08-30 17:01:18 +01:00
jeremy
8686ee7844 makes SCREENSAVER_INTERVAL a #define to save some ram 2024-08-30 11:54:12 -04:00
jacob.eva
17ad6d213d
Improve screensaver to be non-blocking 2024-08-30 15:31:20 +01:00
jacobeva
9d68b58e2e
Merge pull request #22 from jeremybox/screensaver
screensaver
2024-08-30 15:07:36 +01:00
jacob.eva
65acd4f339
Fix corruption / dropped packet issues caused by small UART buffer 2024-08-30 12:07:56 +01:00
jeremy
c80a4caab0 Adds a rudimentary screen saver that briefly (500ms) inverts the screen every 10 minutes on OLED displays to prevent burn-in. 2024-08-29 18:41:52 -04:00
jacob.eva
55d0a41aa8
Remove redundant radio status updates 2024-08-24 15:12:50 +01:00
jacob.eva
36c90de9f8
Only send phy stats *after* sending config parameter reply to master 2024-08-24 11:08:13 +01:00
jacob.eva
7f05a4fd9f
Fix weird behaviour with queue sizing 2024-08-21 17:54:38 +01:00
jacob.eva
d7f2de07c0
Fix BLE pairing behaviour and disable just works pairing 2024-08-21 11:01:38 +01:00
jacob.eva
721cee3603
Fix SPI semaphore lockup issue on ESP32 2024-08-06 17:37:47 +01:00
jacob.eva
a4fe2baf78
Clarify pin requirements 2024-08-03 13:24:27 +01:00
jacob.eva
152e7f17b3
Auto install needed packages, and bypass external management error 2024-08-01 18:04:39 +01:00
jacob.eva
761923e210
Update dependencies 2024-08-01 18:04:31 +01:00
jacob.eva
fe7d745052
Remove last remaining AVR stuff 2024-08-01 17:53:22 +01:00
jacob.eva
e5eea88aa5
Update guide and fix spelling / grammar errors 2024-07-31 22:11:34 +01:00
jacobeva
f778e4d76f
Merge pull request #17 from nathmo/patch-1
Added a few info in CONTRIBUTING.md
2024-07-31 21:26:43 +01:00
Nathann Morand
a4d40ef105
Added a few info in CONTRIBUTING.md
Tried to improve the documentation for futur contributor.
Notably added instruction to also update the Makefile, ad an entry to Utilities.h which I had to discover by trial and error
2024-07-31 13:55:24 +02:00
jacob.eva
003aab4072
Fix issue with SX1280 TX power not being set properly 2024-07-24 15:52:08 +01:00
jacob.eva
02c691481b
Rename freeNode to openCom XL 2024-07-24 08:55:20 +01:00
jacob.eva
f643eba8bb
Add freeNode as supported product 2024-07-23 20:05:02 +01:00
jacob.eva
a287d7b01c
Add rak4631_sx1280 and freenode board variant targets 2024-07-20 16:47:01 +01:00
jacob.eva
282815eb95
Merge branch 't3s3_sx1280' 2024-07-20 16:08:00 +01:00
jacob.eva
c88fe0ed33
Add support for negative TX power values 2024-07-12 15:15:56 +01:00
jacob.eva
e5fcf79e4d
Add support for freeNode to EEPROM 2024-07-12 13:54:50 +01:00
jacob.eva
8b705b2f4e
Fix Bluetooth functionality on NRF52 2024-07-12 13:30:32 +01:00
jacob.eva
fee8d2b28b
Add todo 2024-07-09 10:38:39 +01:00
jacob.eva
ba2d36add9
Switch from board variant being set separately to using model number instead. 2024-07-09 10:37:50 +01:00
jacob.eva
63eab05014
Add clarification for interface_spi 2024-07-09 09:41:14 +01:00
jacob.eva
35e9f36ffd
Add T3S3 target and different variants of the board 2024-07-09 09:40:30 +01:00
jacob.eva
236ea0b999
Update release notes 2024-07-05 10:46:41 +01:00
Mark Qvist
d0ff3d5b31 Apply downstream patch from @jacobeva. Fixes TX power output on RAK boards. 2024-05-26 09:47:54 +02:00
Mark Qvist
8d68a14b89 Updated readme 2024-05-25 01:13:06 +02:00
Mark Qvist
136a81de1b Updated readme 2024-05-21 20:45:44 +02:00
Mark Qvist
f2fcd3dfec Updated readme 2024-05-21 20:44:10 +02:00
Mark Qvist
3d4087931d Updated readme 2024-05-21 20:43:29 +02:00
88 changed files with 6208 additions and 4344 deletions

View File

@ -0,0 +1,39 @@
---
name: "\U0001F41B Bug Report"
about: Report a reproducible bug
title: ''
labels: ''
assignees: ''
---
**Read the Contribution Guidelines**
Before creating a bug report on this issue tracker, you **must** read the [Contribution Guidelines](https://github.com/markqvist/Reticulum/blob/master/Contributing.md). Issues that do not follow the contribution guidelines **will be deleted without comment**.
- The issue tracker is used by developers of this project. **Do not use it to ask general questions, or for support requests**.
- Ideas and feature requests can be made on the [Discussions](https://github.com/markqvist/Reticulum/discussions). **Only** feature requests accepted by maintainers and developers are tracked and included on the issue tracker. **Do not post feature requests here**.
- After reading the [Contribution Guidelines](https://github.com/markqvist/Reticulum/blob/master/Contributing.md), delete this section from your bug report.
**Describe the Bug**
First of all: Is this really a bug? Is it reproducible?
If this is a request for help because something is not working as you expected, stop right here, and go to the [discussions](https://github.com/markqvist/Reticulum/discussions) instead, where you can post your questions and get help from other users.
If this really is a bug or issue with the software, remove this section of the template, and provide **a clear and concise description of what the bug is**.
**To Reproduce**
Describe in detail how to reproduce the bug.
**Expected Behavior**
A clear and concise description of what you expected to happen.
**Logs & Screenshots**
Please include any relevant log output. If applicable, also add screenshots to help explain your problem. In most cases, without any relevant log output, we will not be able to determine the cause of the bug, or reproduce it.
**System Information**
- OS and version
- Python version
- Program version
**Additional context**
Add any other context about the problem here.

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ Release/*.zip
Release/*.json
Console/build
build/*
.vscode

View File

@ -1,4 +1,4 @@
// Copyright (C) 2023, Mark Qvist
// Copyright (C) 2024, Mark Qvist
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -22,19 +22,22 @@
#elif HAS_BLE == true
#include "esp_bt_main.h"
#include "esp_bt_device.h"
// TODO: Remove
#define SerialBT Serial
#include "src/ble/BLESerial.h"
BLESerial SerialBT;
#endif
#elif MCU_VARIANT == MCU_NRF52
#include <bluefruit.h>
#include <math.h>
BLEUart SerialBT;
#define BLE_RX_BUF 6144
BLEUart SerialBT(BLE_RX_BUF);
BLEDis bledis;
BLEBas blebas;
bool SerialBT_init = false;
#endif
#define BT_PAIRING_TIMEOUT 35000
#define BLE_FLUSH_TIMEOUT 20
uint32_t bt_pairing_started = 0;
#define BT_DEV_ADDR_LEN 6
@ -58,6 +61,7 @@ char bt_devname[11];
}
void bt_stop() {
display_unblank();
if (bt_state != BT_STATE_OFF) {
SerialBT.end();
bt_allow_pairing = false;
@ -66,6 +70,7 @@ char bt_devname[11];
}
void bt_start() {
display_unblank();
if (bt_state == BT_STATE_OFF) {
SerialBT.begin(bt_devname);
bt_state = BT_STATE_ON;
@ -73,6 +78,7 @@ char bt_devname[11];
}
void bt_enable_pairing() {
display_unblank();
if (bt_state == BT_STATE_OFF) bt_start();
bt_allow_pairing = true;
bt_pairing_started = millis();
@ -80,12 +86,14 @@ char bt_devname[11];
}
void bt_disable_pairing() {
display_unblank();
bt_allow_pairing = false;
bt_ssp_pin = 0;
bt_state = BT_STATE_ON;
}
void bt_pairing_complete(boolean success) {
display_unblank();
if (success) {
bt_disable_pairing();
} else {
@ -93,7 +101,8 @@ char bt_devname[11];
}
}
void bt_connection_callback(esp_spp_cb_event_t event, esp_spp_cb_param_t *param){
void bt_connection_callback(esp_spp_cb_event_t event, esp_spp_cb_param_t *param) {
display_unblank();
if(event == ESP_SPP_SRV_OPEN_EVT) {
bt_state = BT_STATE_CONNECTED;
cable_state = CABLE_STATE_DISCONNECTED;
@ -156,25 +165,122 @@ char bt_devname[11];
}
#elif HAS_BLE == true
void bt_stop() {
if (bt_state != BT_STATE_OFF) {
bt_allow_pairing = false;
bt_state = BT_STATE_OFF;
}
}
BLESecurity *ble_security = new BLESecurity();
bool ble_authenticated = false;
uint32_t pairing_pin = 0;
void bt_flush() { if (bt_state == BT_STATE_CONNECTED) { SerialBT.flush(); } }
void bt_disable_pairing() {
display_unblank();
bt_allow_pairing = false;
bt_ssp_pin = 0;
bt_state = BT_STATE_ON;
}
void bt_connect_callback(uint16_t conn_handle) {
void bt_passkey_notify_callback(uint32_t passkey) {
// Serial.printf("Got passkey notification: %d\n", passkey);
bt_ssp_pin = passkey;
bt_state = BT_STATE_PAIRING;
bt_allow_pairing = true;
bt_pairing_started = millis();
kiss_indicate_btpin();
}
bool bt_confirm_pin_callback(uint32_t pin) {
// Serial.printf("Confirm PIN callback: %d\n", pin);
return true;
}
void bt_debond_all() {
// Serial.println("Debonding all");
int dev_num = esp_ble_get_bond_device_num();
esp_ble_bond_dev_t *dev_list = (esp_ble_bond_dev_t *)malloc(sizeof(esp_ble_bond_dev_t) * dev_num);
esp_ble_get_bond_device_list(&dev_num, dev_list);
for (int i = 0; i < dev_num; i++) { esp_ble_remove_bond_device(dev_list[i].bd_addr); }
free(dev_list);
}
void bt_update_passkey() {
// Serial.println("Updating passkey");
pairing_pin = random(899999)+100000;
bt_ssp_pin = pairing_pin;
}
uint32_t bt_passkey_callback() {
// Serial.println("API passkey request");
if (pairing_pin == 0) { bt_update_passkey(); }
return pairing_pin;
}
bool bt_client_authenticated() {
return ble_authenticated;
}
void bt_security_setup() {
uint32_t passkey = bt_passkey_callback();
// Serial.printf("Executing BT security setup, passkey is %d\n", passkey);
uint8_t key_size = 16;
uint8_t init_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK;
uint8_t rsp_key = ESP_BLE_ENC_KEY_MASK | ESP_BLE_ID_KEY_MASK;
esp_ble_auth_req_t auth_req = ESP_LE_AUTH_REQ_SC_MITM_BOND;
uint8_t auth_option = ESP_BLE_ONLY_ACCEPT_SPECIFIED_AUTH_ENABLE;
uint8_t oob_support = ESP_BLE_OOB_DISABLE;
esp_ble_io_cap_t iocap = ESP_IO_CAP_OUT;
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_STATIC_PASSKEY, &passkey, sizeof(uint32_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_AUTHEN_REQ_MODE, &auth_req, sizeof(uint8_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_IOCAP_MODE, &iocap, sizeof(uint8_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_MAX_KEY_SIZE, &key_size, sizeof(uint8_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_ONLY_ACCEPT_SPECIFIED_SEC_AUTH, &auth_option, sizeof(uint8_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_OOB_SUPPORT, &oob_support, sizeof(uint8_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_INIT_KEY, &init_key, sizeof(uint8_t));
esp_ble_gap_set_security_param(ESP_BLE_SM_SET_RSP_KEY, &rsp_key, sizeof(uint8_t));
}
bool bt_security_request_callback() {
if (bt_allow_pairing) {
// Serial.println("Accepting security request");
return true;
} else {
// Serial.println("Rejecting security request");
return false;
}
}
void bt_authentication_complete_callback(esp_ble_auth_cmpl_t auth_result) {
if (auth_result.success == true) {
// Serial.println("Authentication success");
ble_authenticated = true;
bt_state = BT_STATE_CONNECTED;
} else {
// Serial.println("Authentication fail");
ble_authenticated = false;
bt_state = BT_STATE_ON;
bt_security_setup();
}
bt_allow_pairing = false;
bt_ssp_pin = 0;
}
void bt_connect_callback(BLEServer *server) {
// uint16_t conn_id = server->getConnId();
// Serial.printf("Connected: %d\n", conn_id);
display_unblank();
ble_authenticated = false;
bt_state = BT_STATE_CONNECTED;
cable_state = CABLE_STATE_DISCONNECTED;
}
void bt_disconnect_callback(uint16_t conn_handle, uint8_t reason) {
void bt_disconnect_callback(BLEServer *server) {
// uint16_t conn_id = server->getConnId();
// Serial.printf("Disconnected: %d\n", conn_id);
display_unblank();
ble_authenticated = false;
bt_state = BT_STATE_ON;
}
@ -199,8 +305,8 @@ char bt_devname[11];
sprintf(bt_devname, "RNode %02X%02X", bt_dh[14], bt_dh[15]);
free(data);
// TODO: Implement GAP & GATT for RNode comms over BLE
bt_security_setup();
bt_ready = true;
return true;
@ -211,9 +317,20 @@ char bt_devname[11];
}
void bt_start() {
display_unblank();
if (bt_state == BT_STATE_OFF) {
bt_state = BT_STATE_ON;
// TODO: Implement
SerialBT.begin(bt_devname);
SerialBT.setTimeout(10);
}
}
void bt_stop() {
display_unblank();
if (bt_state != BT_STATE_OFF) {
bt_allow_pairing = false;
bt_state = BT_STATE_OFF;
SerialBT.end();
}
}
@ -228,7 +345,13 @@ char bt_devname[11];
}
void bt_enable_pairing() {
display_unblank();
if (bt_state == BT_STATE_OFF) bt_start();
bt_security_setup();
//bt_debond_all();
//bt_update_passkey();
bt_allow_pairing = true;
bt_pairing_started = millis();
bt_state = BT_STATE_PAIRING;
@ -238,123 +361,193 @@ char bt_devname[11];
if (bt_allow_pairing && millis()-bt_pairing_started >= BT_PAIRING_TIMEOUT) {
bt_disable_pairing();
}
if (bt_state == BT_STATE_CONNECTED && millis()-SerialBT.lastFlushTime >= BLE_FLUSH_TIMEOUT) {
if (SerialBT.transmitBufferLength > 0) {
bt_flush();
}
}
}
#endif
#elif MCU_VARIANT == MCU_NRF52
uint8_t eeprom_read(uint32_t mapped_addr);
uint32_t pairing_pin = 0;
void bt_stop() {
if (bt_state != BT_STATE_OFF) {
bt_allow_pairing = false;
bt_state = BT_STATE_OFF;
uint8_t eeprom_read(uint32_t mapped_addr);
void bt_stop() {
if (bt_state != BT_STATE_OFF) {
bt_allow_pairing = false;
bt_state = BT_STATE_OFF;
}
}
}
void bt_disable_pairing() {
bt_allow_pairing = false;
bt_ssp_pin = 0;
bt_state = BT_STATE_ON;
}
void bt_disable_pairing() {
bt_allow_pairing = false;
bt_ssp_pin = 0;
bt_state = BT_STATE_ON;
}
void bt_pairing_complete(uint16_t conn_handle, uint8_t auth_status) {
void bt_flush() { if (bt_state == BT_STATE_CONNECTED) { SerialBT.flushTXD(); } }
void bt_pairing_complete(uint16_t conn_handle, uint8_t auth_status) {
if (auth_status == BLE_GAP_SEC_STATUS_SUCCESS) {
bt_state = BT_STATE_CONNECTED;
cable_state = CABLE_STATE_DISCONNECTED;
bt_disable_pairing();
BLEConnection* connection = Bluefruit.Connection(conn_handle);
ble_gap_conn_sec_mode_t security = connection->getSecureMode();
// On the NRF52 it is not possible with the Arduino library to reject
// requests from devices with no IO capabilities, which would allow
// bypassing pin entry through pairing using the "just works" mode.
// Therefore, we must check the security level of the connection after
// pairing to ensure "just works" has not been used. If it has, we need
// to disconnect, unpair and delete any bonding information immediately.
// Settings on the SerialBT service should prevent unauthorised access to
// the serial port anyway, but this is still wise to do regardless.
//
// Note: It may be nice to have this done in the BLESecurity class in the
// future, but as it stands right now I'd have to fork the BSP to do
// that, which I don't fancy doing. Impact on security is likely minimal.
// Requires investigation.
if (security.sm == 1 && security.lv >= 3) {
bt_state = BT_STATE_CONNECTED;
cable_state = CABLE_STATE_DISCONNECTED;
bt_disable_pairing();
} else {
if (connection->bonded()) {
connection->removeBondKey();
}
connection->disconnect();
}
} else {
bt_ssp_pin = 0;
}
}
}
bool bt_passkey_callback(uint16_t conn_handle, uint8_t const passkey[6], bool match_request) {
for (int i = 0; i < 6; i++) {
// multiply by tens however many times needed to make numbers appear in order
bt_ssp_pin += ((int)passkey[i] - 48) * pow(10, 5-i);
}
kiss_indicate_btpin();
if (match_request) {
if (bt_allow_pairing) {
return true;
}
bool bt_passkey_callback(uint16_t conn_handle, uint8_t const passkey[6], bool match_request) {
if (bt_allow_pairing) {
return true;
}
return false;
}
}
void bt_disconnect_callback(uint16_t conn_handle, uint8_t reason) {
bt_state = BT_STATE_ON;
}
void bt_connect_callback(uint16_t conn_handle) {
bt_state = BT_STATE_CONNECTED;
cable_state = CABLE_STATE_DISCONNECTED;
bool bt_setup_hw() {
if (!bt_ready) {
#if HAS_EEPROM
if (EEPROM.read(eeprom_addr(ADDR_CONF_BT)) == BT_ENABLE_BYTE) {
#else
if (eeprom_read(eeprom_addr(ADDR_CONF_BT)) == BT_ENABLE_BYTE) {
#endif
bt_enabled = true;
} else {
bt_enabled = false;
BLEConnection* conn = Bluefruit.Connection(conn_handle);
conn->requestPHY(BLE_GAP_PHY_2MBPS);
conn->requestMtuExchange(512+3);
conn->requestDataLengthUpdate();
}
void bt_disconnect_callback(uint16_t conn_handle, uint8_t reason) {
if (reason != BLE_GAP_SEC_STATUS_SUCCESS) {
bt_state = BT_STATE_ON;
}
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
Bluefruit.autoConnLed(false);
if (Bluefruit.begin()) {
Bluefruit.setTxPower(8); // Check bluefruit.h for supported values
Bluefruit.Security.setIOCaps(true, true, false);
Bluefruit.Security.setPairPasskeyCallback(bt_passkey_callback);
Bluefruit.Periph.setDisconnectCallback(bt_disconnect_callback);
Bluefruit.Security.setPairCompleteCallback(bt_pairing_complete);
const ble_gap_addr_t gap_addr = Bluefruit.getAddr();
char *data = (char*)malloc(BT_DEV_ADDR_LEN+1);
for (int i = 0; i < BT_DEV_ADDR_LEN; i++) {
data[i] = gap_addr.addr[i];
}
}
void bt_update_passkey() {
pairing_pin = random(899999)+100000;
bt_ssp_pin = pairing_pin;
}
uint32_t bt_get_passkey() {
// Serial.println("API passkey request");
if (pairing_pin == 0) { bt_update_passkey(); }
return pairing_pin;
}
bool bt_setup_hw() {
if (!bt_ready) {
#if HAS_EEPROM
data[BT_DEV_ADDR_LEN] = EEPROM.read(eeprom_addr(ADDR_SIGNATURE));
if (EEPROM.read(eeprom_addr(ADDR_CONF_BT)) == BT_ENABLE_BYTE) {
#else
data[BT_DEV_ADDR_LEN] = eeprom_read(eeprom_addr(ADDR_SIGNATURE));
if (eeprom_read(eeprom_addr(ADDR_CONF_BT)) == BT_ENABLE_BYTE) {
#endif
unsigned char *hash = MD5::make_hash(data, BT_DEV_ADDR_LEN);
memcpy(bt_dh, hash, BT_DEV_HASH_LEN);
sprintf(bt_devname, "RNode %02X%02X", bt_dh[14], bt_dh[15]);
free(data);
bt_enabled = true;
} else {
bt_enabled = false;
}
Bluefruit.configPrphBandwidth(BANDWIDTH_MAX);
Bluefruit.autoConnLed(false);
if (Bluefruit.begin()) {
uint32_t pin = bt_get_passkey();
char pin_char[6];
sprintf(pin_char,"%lu", pin);
bt_ready = true;
return true;
Bluefruit.setTxPower(8); // Check bluefruit.h for supported values
Bluefruit.Security.setIOCaps(true, false, false); // display, yes; yes / no, no; keyboard, no
// This device is indeed capable of yes / no through the pairing mode
// being set, but I have chosen to set it thus to force the input of the
// pin on the device initiating the pairing.
Bluefruit.Security.setMITM(true);
Bluefruit.Security.setPairPasskeyCallback(bt_passkey_callback);
Bluefruit.Security.setSecuredCallback(bt_connect_callback);
Bluefruit.Security.setPIN(pin_char);
Bluefruit.Periph.setDisconnectCallback(bt_disconnect_callback);
Bluefruit.Security.setPairCompleteCallback(bt_pairing_complete);
Bluefruit.Periph.setConnInterval(6, 12); // 7.5 - 15 ms
const ble_gap_addr_t gap_addr = Bluefruit.getAddr();
char *data = (char*)malloc(BT_DEV_ADDR_LEN+1);
for (int i = 0; i < BT_DEV_ADDR_LEN; i++) {
data[i] = gap_addr.addr[i];
}
#if HAS_EEPROM
data[BT_DEV_ADDR_LEN] = EEPROM.read(eeprom_addr(ADDR_SIGNATURE));
#else
data[BT_DEV_ADDR_LEN] = eeprom_read(eeprom_addr(ADDR_SIGNATURE));
#endif
unsigned char *hash = MD5::make_hash(data, BT_DEV_ADDR_LEN);
memcpy(bt_dh, hash, BT_DEV_HASH_LEN);
sprintf(bt_devname, "RNode %02X%02X", bt_dh[14], bt_dh[15]);
free(data);
bt_ready = true;
return true;
} else { return false; }
} else { return false; }
} else { return false; }
}
}
void bt_start() {
if (bt_state == BT_STATE_OFF) {
Bluefruit.setName(bt_devname);
bledis.setManufacturer(BLE_MANUFACTURER);
bledis.setModel(BLE_MODEL);
// start device information service
bledis.begin();
void bt_start() {
if (bt_state == BT_STATE_OFF) {
Bluefruit.setName(bt_devname);
bledis.setManufacturer(BLE_MANUFACTURER);
bledis.setModel(BLE_MODEL);
// start device information service
bledis.begin();
SerialBT.begin();
// Guard to ensure SerialBT service is not duplicated through BT being power cycled
if (!SerialBT_init) {
SerialBT.bufferTXD(true); // enable buffering
blebas.begin();
SerialBT.setPermission(SECMODE_ENC_WITH_MITM, SECMODE_ENC_WITH_MITM); // enable encryption for BLE serial
SerialBT.begin();
SerialBT_init = true;
}
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
Bluefruit.Advertising.addTxPower();
blebas.begin();
// Include bleuart 128-bit uuid
Bluefruit.Advertising.addService(SerialBT);
Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
Bluefruit.Advertising.addTxPower();
// There is no room for Name in Advertising packet
// Use Scan response for Name
Bluefruit.ScanResponse.addName();
// Include bleuart 128-bit uuid
Bluefruit.Advertising.addService(SerialBT);
Bluefruit.Advertising.start(0);
// There is no room for Name in Advertising packet
// Use Scan response for Name
Bluefruit.ScanResponse.addName();
bt_state = BT_STATE_ON;
}
}
Bluefruit.Advertising.start(0);
bool bt_init() {
bt_state = BT_STATE_ON;
}
}
bool bt_init() {
bt_state = BT_STATE_OFF;
if (bt_setup_hw()) {
if (bt_enabled && !console_active) bt_start();
@ -362,18 +555,19 @@ bool bt_init() {
} else {
return false;
}
}
void bt_enable_pairing() {
if (bt_state == BT_STATE_OFF) bt_start();
bt_allow_pairing = true;
bt_pairing_started = millis();
bt_state = BT_STATE_PAIRING;
}
void update_bt() {
if (bt_allow_pairing && millis()-bt_pairing_started >= BT_PAIRING_TIMEOUT) {
bt_disable_pairing();
}
}
void bt_enable_pairing() {
if (bt_state == BT_STATE_OFF) bt_start();
bt_allow_pairing = true;
bt_pairing_started = millis();
bt_state = BT_STATE_PAIRING;
kiss_indicate_btpin();
}
void update_bt() {
if (bt_allow_pairing && millis()-bt_pairing_started >= BT_PAIRING_TIMEOUT) {
bt_disable_pairing();
}
}
#endif

869
Boards.h

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
// Copyright (C) 2023, Mark Qvist
// Copyright (C) 2024, Mark Qvist
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@
#define CONFIG_H
#define MAJ_VERS 0x01
#define MIN_VERS 0x49
#define MIN_VERS 0x4a
#define MODE_HOST 0x11
#define MODE_TNC 0x12
@ -28,6 +28,8 @@
#define CABLE_STATE_DISCONNECTED 0x00
#define CABLE_STATE_CONNECTED 0x01
uint8_t cable_state = CABLE_STATE_DISCONNECTED;
#define MAX_INTERFACES 12
#define BT_STATE_NA 0xff
#define BT_STATE_OFF 0x00
@ -63,12 +65,6 @@
// packet RSSI register
const int rssi_offset = 157;
// Default LoRa settings
const int lora_rx_turnaround_ms = 66;
const int lora_post_tx_yield_slots = 6;
#define LORA_CAD_SYMBOLS 3
// Operational variables
bool community_fw = true;
bool hw_ready = false;
@ -76,17 +72,25 @@
bool pmu_ready = false;
bool promisc = false;
bool implicit = false;
bool memory_low = false;
uint8_t implicit_l = 0;
uint8_t op_mode = MODE_HOST;
uint8_t model = 0x00;
uint8_t hwrev = 0x00;
int current_rssi = -292;
int last_rssi = -292;
uint8_t last_rssi_raw = 0x00;
uint8_t last_snr_raw = 0x80;
uint8_t seq = 0xFF;
uint16_t read_len = 0;
uint8_t seq[INTERFACE_COUNT];
uint16_t read_len[INTERFACE_COUNT];
bool serial_in_frame = false;
FIFOBuffer packet_rdy_interfaces;
uint8_t packet_rdy_interfaces_buf[MAX_INTERFACES];
// Incoming packet buffer
uint8_t pbuf[MTU];
@ -100,13 +104,27 @@
uint32_t stat_rx = 0;
uint32_t stat_tx = 0;
unsigned long last_tx = 0;
unsigned long last_rx = 0;
bool stat_signal_detected = false;
bool stat_signal_synced = false;
bool stat_rx_ongoing = false;
bool dcd = false;
bool dcd_led = false;
bool dcd_waiting = false;
long dcd_wait_until = 0;
uint16_t dcd_count = 0;
uint16_t dcd_threshold = 2;
uint32_t last_status_update = 0;
uint32_t last_dcd = 0;
uint32_t last_rx = 0;
uint32_t last_tx = 0;
// Power management
#define BATTERY_STATE_UNKNOWN 0x00
#define BATTERY_STATE_DISCHARGING 0x01
#define BATTERY_STATE_CHARGING 0x02
#define BATTERY_STATE_CHARGED 0x03
#define BATTERY_STATE_CHARGING 0x02
#define BATTERY_STATE_CHARGED 0x03
bool battery_installed = false;
bool battery_indeterminate = false;
bool external_power = false;
@ -116,6 +134,8 @@
uint8_t battery_state = 0x00;
uint8_t display_intensity = 0xFF;
uint8_t display_addr = 0xFF;
volatile bool display_updating = false;
bool display_blanking_enabled = false;
bool display_diagnostics = true;
bool device_init_done = false;
bool eeprom_ok = false;
@ -123,9 +143,9 @@
// Boot flags
#define START_FROM_BOOTLOADER 0x01
#define START_FROM_POWERON 0x02
#define START_FROM_BROWNOUT 0x03
#define START_FROM_JTAG 0x04
#define START_FROM_POWERON 0x02
#define START_FROM_BROWNOUT 0x03
#define START_FROM_JTAG 0x04
// Subinterfaces
// select interface 0 by default

View File

@ -1,4 +1,4 @@
// Copyright (C) 2023, Mark Qvist
// Copyright (C) 2024, Mark Qvist
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,6 @@
# These paths will have to be changed according to where you store these directories on your system
PATH_RETICULUM_WEBSITE=../../sites/reticulum.network
PATH_PACKAGES=../../dist_archive
PATH_PACKAGES=../../../rns_build
clean:
@echo Cleaning...
@ -14,14 +15,14 @@ dirs:
@mkdir -p ./build/images
pages:
python ./build.py
python3 ./build.py
pages-debug:
python ./build.py --no-gz --no-remap
python3 ./build.py --no-gz --no-remap
sourcepack:
@echo Packing firmware sources...
zip --junk-paths -r build/pkg/rnode_firmware.zip ../arduino-cli.yaml ../Bluetooth.h ../Boards.h ../Config.h ../Console.h ../Device.h ../Display.h ../Framing.h ../Graphics.h ../Input.h ../LICENSE ../Makefile ../MD5.cpp ../MD5.h ../Modem.h ../partition_hashes ../Power.h ../README.md ../release_hashes.py ../RNode_Firmware_CE.ino ../ROM.h ../sx126x.cpp ../sx126x.h ../sx127x.cpp ../sx127x.h ../sx128x.cpp ../sx128x.h ../Utilities.h
cd .. && zip -r Console/build/pkg/rnode_firmware.zip * -x Builds/\* Console/\* Documentation/images/\* Documentation/RNode_v1_Manual.pdf Documentation/rnfw_1.jpg Graphics/\* Python\ Module/\* Release/\* build/\* partition_hashes
data:
@echo Including assets...
@ -29,7 +30,7 @@ data:
@cp assets/gfx/* build/gfx/
@cp assets/images/* build/images/
@cp assets/stl/* build/3d/
#@cp assets/pkg/* build/pkg/
# @cp assets/pkg/* build/pkg/
# @cp assets/scripts/* build/scripts/
# @cp -r ../../Reticulum/docs/manual/* build/reticulum_manual/
# @cp -r ../../Reticulum/docs/Reticulum\ Manual.pdf build/reticulum_manual/
@ -44,4 +45,4 @@ site: clean external dirs data sourcepack pages
local: clean external dirs data sourcepack pages-debug
serve:
python -m http.server 7777 --bind 127.0.0.1 --directory ./build
python3 -m http.server 7777 --bind 127.0.0.1 --directory ./build

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -4,17 +4,20 @@ import sys
import shutil
packages = {
"rns": "rns-0.7.5-py3-none-any.whl",
"nomadnet": "nomadnet-0.4.9-py3-none-any.whl",
"lxmf": "lxmf-0.4.3-py3-none-any.whl",
"rnsh": "rnsh-0.1.4-py3-none-any.whl",
"rns": "rns-0.9.1-py3-none-any.whl",
"nomadnet": "nomadnet-0.6.0-py3-none-any.whl",
"lxmf": "lxmf-0.6.2-py3-none-any.whl",
"rnsh": "rnsh-0.1.5-py3-none-any.whl",
}
DEFAULT_TITLE = "RNode Bootstrap Console"
SOURCES_PATH="./source"
BUILD_PATH="./build"
PACKAGES_PATH = "../../dist_archive"
# These paths may have to be changed depending on where you store these directories on your system
PACKAGES_PATH = "../../../rns_build"
RNS_SOURCE_PATH = "../../Reticulum"
INPUT_ENCODING="utf-8"
OUTPUT_ENCODING="utf-8"
@ -174,26 +177,34 @@ mf.write(help_redirect)
mf.close()
def optimise_manual(path):
pm = 110
pm = 45
scale_imgs = [
("_images/board_rnodev2.png", pm),
("_images/board_rnode.png", pm),
("_images/board_heltec32.png", pm),
("_images/board_heltec32v20.png", pm),
("_images/board_heltec32v30.png", pm),
("_images/board_t3v21.png", pm),
("_images/board_t3v20.png", pm),
("_images/sideband_devices.webp", pm),
("_images/board_t3v10.png", pm),
("_images/board_t3s3.png", pm),
("_images/board_tbeam.png", pm),
("_images/board_tdeck.png", pm),
("_images/board_rak4631.png", pm),
("_images/board_tbeam_supreme.png", pm),
("_images/sideband_devices.webp", pm),
("_images/nomadnet_3.png", pm),
("_images/meshchat_1.webp", pm),
("_images/radio_is5ac.png", pm),
("_images/radio_rblhg5.png", pm),
("_static/rns_logo_512.png", 256),
("../images/bg_h_1.webp", pm),
]
import subprocess
import shlex
for i,s in scale_imgs:
fp = path+"/"+i
resize = "convert "+fp+" -resize "+str(s)+" "+fp
resize = "convert "+fp+" -quality 25 -resize "+str(s)+" "+fp
print(resize)
subprocess.call(shlex.split(resize), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
@ -205,6 +216,7 @@ def optimise_manual(path):
"_static/scripts/furo.js.map",
"_static/jquery-3.6.0.js",
"_static/jquery.js",
"static/underscore-1.13.1.js",
"_static/_sphinx_javascript_frameworks_compat.js",
"_static/scripts/furo.js.LICENSE.txt",
"_static/styles/furo-extensions.css.map",

View File

@ -2,7 +2,6 @@
[title]: <> (How To Make Your Own RNodes)
[image]: <> (images/g3p.webp)
[excerpt]: <> (This article will outline the general process, and provide the information you need, for building your own RNode from a few basic modules. The RNode will be functionally identical to a commercially purchased board.)
<div class="article_date">{DATE}</div>
# How To Make Your Own RNodes
This article will outline the general process, and provide the information you need, for building your own RNode from a few basic modules. The RNode will be functionally identical to a purchased device.
@ -31,10 +30,9 @@ Currently, the RNode firmware supports a variety of different microcontrollers,
Regarding the LoRa transceiver module, there is going to be an almost overwhelming amount of options to choose from. To narrow it down, here are the essential characteristics to look for:
- The RNode firmware needs a module based on the **Semtech SX1276** or **Semtech SX1278** LoRa transceiver IC. These come in several different variants, for all frequency bands from about 150 MHz to about 1100 MHz.
- Support for **SX1262**, **SX1268** and **SX1280**-based modules is coming soon, but until that is released, only **SX1276** and **SX1278** modules will work.
- The RNode firmware needs a module based on the **Semtech SX1276**, **Semtech SX1278**, **SX1262**, **SX1268** and **SX1280** LoRa transceiver ICs. These come in several different variants, for all frequency bands from about 150 MHz to 2500 MHz.
- The module *must* expose the direct SPI bus to the transceiver chip. UART based modules that add their own communications layer will not work.
- The module must also expose the *reset* line of the chip, and provide the **DIO0** interrupt signal *from* the chip.
- The module must also expose the *reset* line of the chip, and provide the **DIO0** (or other relevant) interrupt signal *from* the chip.
- As mentioned above, the module must be logic-level compatible with the microcontroller you are using, unless you want to add a level-shifter. Resistor divider arrays will most likely not work here, due to the bus speeds required.
Keeping those things in mind, you should be able to select a suitable combination of microcontroller board and transceiver module.
@ -56,12 +54,17 @@ In the photo above I used an Adafruit Feather ESP32 board and a ModTronix inAir4
9. Connect the *DIO0* pin of the transceiver module to the *DIO0 interrupt pin* of the microcontroller board.
10. You can optionally connect transmit and receiver LEDs to the corresponding pins of the microcontroller board.
The pin layouts of your transceiver module and microcontroller board will vary, but you can look up the correct pin assignments for your processor type and board layout in the `Config.h` file of the [RNode Firmware]({ASSET_PATH}pkg/rnode_firmware.zip).
The pin layouts of your transceiver module and microcontroller board will vary, but you can look up the correct pin assignments for your processor type and board layout in the [Config.h](https://github.com/markqvist/RNode_Firmware/blob/master/Config.h) file of the [RNode Firmware](https://unsigned.io/rnode_firmware).
## Loading the Firmware
Once the hardware is assembled, you are ready to load the firmware onto the board and configure the configuration parameters in the boards EEPROM. Luckily, this process is completely automated by the [RNode Configuration Utility]({ASSET_PATH}m/using.html#the-rnodeconf-utility).
### Loading the Firmware
Once the hardware is assembled, you are ready to load the firmware onto the board and configure the configuration parameters in the boards EEPROM. Luckily, this process is completely automated by the [RNode Configuration Utility](https://markqvist.github.io/Reticulum/manual/using.html#the-rnodeconf-utility). To prepare for loading the firmware, make sure that `python` and `pip` is installed on your system, then install the `rns` package (which includes the `rnodeconf` program) by issuing the command:
The `rnodeconf` program is included in the `rns` package. Please read [these instructions]({ASSET_PATH}s_rns.html) for more information on how to install it from this repository, or from the Internet. If installation goes well, you can now move on to the next step.
```txt
pip install rns
```
If installation goes well, you can now move on to the next step.
> *Take Care*: A LoRa transceiver module **must** be connected to the board for the firmware to start and accept commands. If the firmware does not verify that the correct transceiver is available on the SPI bus, execution is stopped, and the board will not accept commands. If you find the board unresponsive after installing the firmware, or EEPROM configuration fails, double-check your transceiver module wiring!
@ -73,24 +76,6 @@ rnodeconf --autoinstall
The installer will now ask you to insert the device you want to set up, scan for connected serial ports, and ask you a number of questions regarding the device. When it has the information it needs, it will install the correct firmware and configure the necessary parameters in the device EEPROM for it to function properly.
> **Please Note!** If you are connected to the Internet while installing, the autoinstaller will automatically download any needed firmware files to a local cache before installing.
> If you do not have an active Internet connection while installing, you can extract and use the firmware from this device instead. This will **only** work if you are building the same type of RNode as the device you are extracting from, as the firmware has to match the targeted board and hardware configuration.
If you need to extract the firmware from an existing RNode, run the following command:
```
rnodeconf --extract
```
If `rnodeconf` finds a working RNode, it will extract and save the firmware from the device for later use. You can then run the auto-installer with the `--use-extracted` option to use the locally extracted file:
```
rnodeconf --autoinstall --use-extracted
```
This also works for updating the firmware on existing RNodes, so you can extract a newer firmware from one RNode, and deploy it onto other RNodes using the same method. Just use the `--update` option instead of `--autoinstall`.
If the install goes well, you will be greated with a success message telling you that your device is now ready. To confirm everything is OK, you can query the device info with:
```txt

View File

@ -1,4 +1,4 @@
// Copyright (C) 2023, Mark Qvist
// Copyright (C) 2024, Mark Qvist
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -36,6 +36,8 @@
#define APPLICATION_START 0x26000
#define USER_DATA_START 0xED000
#define IMG_SIZE_START 0xFF008
#endif
#endif
@ -141,6 +143,13 @@ void device_save_firmware_hash() {
}
#if MCU_VARIANT == MCU_NRF52
uint32_t retrieve_application_size() {
uint8_t bytes[4];
memcpy(bytes, (const void*)IMG_SIZE_START, 4);
uint32_t fw_len = bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24;
return fw_len;
}
void calculate_region_hash(unsigned long long start, unsigned long long end, uint8_t* return_hash) {
// this function calculates the hash digest of a region of memory,
// currently it is only designed to work for the application region
@ -152,16 +161,12 @@ void calculate_region_hash(unsigned long long start, unsigned long long end, uin
hash.begin(CRYS_HASH_SHA256_mode);
bool finish = false;
uint8_t size;
bool application = true;
int end_count = 0;
unsigned long length = 0;
while (start < end - 1 ) {
while (start < end ) {
const void* src = (const void*)start;
if (start + CHUNK_SIZE >= end) {
size = (end - 1) - start;
size = end - start;
}
else {
size = CHUNK_SIZE;
@ -169,74 +174,9 @@ void calculate_region_hash(unsigned long long start, unsigned long long end, uin
memcpy(chunk, src, CHUNK_SIZE);
// check if we've reached the end of the program
// if we're checking the application region
if (application) {
for (int i = 0; i < CHUNK_SIZE; i++) {
if (chunk[i] == 0xFF) {
bool matched = true;
end_count = 1;
// check if rest of chunk is FFs as well, only if FF is not
// at the end of chunk
if (i < CHUNK_SIZE - 1) {
for (int x = 0; x < CHUNK_SIZE - i; x++) {
if (chunk[i+x] != 0xFF) {
matched = false;
break;
}
end_count++;
}
}
if (matched) {
while (end_count < END_SECTION_SIZE) {
// check if bytes in next chunk up to total
// required are also FFs
for (int x = 1; x <= ceil(END_SECTION_SIZE / CHUNK_SIZE); x++) {
const void* src_next = (const void*)start + CHUNK_SIZE*x;
if ((END_SECTION_SIZE - end_count) > CHUNK_SIZE) {
size = CHUNK_SIZE;
} else {
size = END_SECTION_SIZE - end_count;
}
memcpy(chunk_next, src_next, size);
for (int y = 0; y < size; y++) {
if (chunk_next[y] != 0xFF) {
matched = false;
break;
}
end_count++;
}
if (!matched) {
break;
}
}
if (!matched) {
break;
}
}
if (matched) {
finish = true;
size = i;
break;
}
}
}
}
}
if (finish) {
hash.update(chunk, size);
length += size;
break;
} else {
hash.update(chunk, size);
}
hash.update(chunk, size);
start += CHUNK_SIZE;
length += CHUNK_SIZE;
}
hash.end(return_hash);
}
@ -257,16 +197,14 @@ void device_validate_partitions() {
esp_partition_get_sha256(esp_ota_get_running_partition(), dev_firmware_hash);
#elif MCU_VARIANT == MCU_NRF52
// todo, add bootloader, partition table, or softdevice?
calculate_region_hash(APPLICATION_START, USER_DATA_START, dev_firmware_hash);
calculate_region_hash(APPLICATION_START, APPLICATION_START+retrieve_application_size(), dev_firmware_hash);
#endif
#if VALIDATE_FIRMWARE
for (uint8_t i = 0; i < DEV_HASH_LEN; i++) {
if (dev_firmware_hash_target[i] != dev_firmware_hash[i]) {
fw_signature_validated = false;
break;
}
}
#endif
}
bool device_firmware_ok() {
@ -275,6 +213,7 @@ bool device_firmware_ok() {
#if MCU_VARIANT == MCU_ESP32 || MCU_VARIANT == MCU_NRF52
bool device_init() {
#if VALIDATE_FIRMWARE
if (bt_ready) {
#if MCU_VARIANT == MCU_ESP32
for (uint8_t i=0; i<EEPROM_SIG_LEN; i++){dev_eeprom_signature[i]=EEPROM.read(eeprom_addr(ADDR_SIGNATURE+i));}
@ -310,9 +249,9 @@ bool device_init() {
hash.end(dev_hash);
#endif
device_load_signature();
device_validate_signature();
device_validate_partitions();
#if MCU_VARIANT == MCU_NRF52
@ -323,5 +262,10 @@ bool device_init() {
} else {
return false;
}
#else
// Skip hash comparison and checking BT
device_init_done = true;
return device_init_done;
#endif
}
#endif

1367
Display.h

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
# Building
## Prerequisites
The build system of this repository is based on Make. The `Makefile` is in the base of the repository. Please ensure you have `arduino-cli` installed before proceeding.
The build system of this repository is based on GNU Make. The `Makefile` is in the base of the repository. Please ensure you have `arduino-cli`, `python3` and `make` installed before proceeding.
Firstly, figure out which MCU platform your supported board is based on. The table below can help you.
@ -54,6 +54,60 @@ Ensure you replace [target] with the target you selected. For example:
`make upload-rak4631`
If you are flashing a custom board, you will need to generate a signing key in rnodeconf prior to flashing if you do not already have one by running:
`rnodeconf -k`
After flashing a custom board, you will also need to provision the EEPROM before use:
`rnodeconf /dev/ttyACM0 -r --platform ESP32 --model a9 --product f0 --hwrev 3`
- platform must either be AVR, ESP32 or NRF52
- hwrev is required (any integer between 1 and 255)
- model should be something from the list below without the leading `0x` and in lowercase (example `e8`):
```
0x11: [430000000, 510000000, 22, "430 - 510 MHz", "rnode_firmware_rak4631.zip", "SX1262"],
0x12: [779000000, 928000000, 22, "779 - 928 MHz", "rnode_firmware_rak4631.zip", "SX1262"],
0xA4: [410000000, 525000000, 14, "410 - 525 MHz", "rnode_firmware.hex", "SX1278"],
0xA9: [820000000, 1020000000, 17, "820 - 1020 MHz", "rnode_firmware.hex", "SX1276"],
0xA1: [410000000, 525000000, 22, "410 - 525 MHz", "rnode_firmware_t3s3.zip", "SX1268"],
0xA6: [820000000, 1020000000, 22, "820 - 960 MHz", "rnode_firmware_t3s3.zip", "SX1262"],
0xA2: [410000000, 525000000, 17, "410 - 525 MHz", "rnode_firmware_ng21.zip", "SX1278"],
0xA7: [820000000, 1020000000, 17, "820 - 1020 MHz", "rnode_firmware_ng21.zip", "SX1276"],
0xA3: [410000000, 525000000, 17, "410 - 525 MHz", "rnode_firmware_ng20.zip", "SX1278"],
0xA8: [820000000, 1020000000, 17, "820 - 1020 MHz", "rnode_firmware_ng20.zip", "SX1276"],
0xB3: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_lora32v20.zip", "SX1278"],
0xB8: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_lora32v20.zip", "SX1276"],
0xB4: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_lora32v21.zip", "SX1278"],
0xB9: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_lora32v21.zip", "SX1276"],
0x04: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_lora32v21_tcxo.zip", "SX1278"],
0x09: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_lora32v21_tcxo.zip", "SX1276"],
0xBA: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_lora32v10.zip", "SX1278"],
0xBB: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_lora32v10.zip", "SX1276"],
0xC4: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_heltec32v2.zip", "SX1278"],
0xC9: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_heltec32v2.zip", "SX1276"],
0xC5: [470000000, 510000000, 21, "470 - 510 MHz", "rnode_firmware_heltec32v3.zip", "SX1262"],
0xCA: [863000000, 928000000, 21, "863 - 928 MHz", "rnode_firmware_heltec32v3.zip", "SX1262"],
0xE4: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_tbeam.zip", "SX1278"],
0xE9: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_tbeam.zip", "SX1276"],
0xE3: [420000000, 520000000, 22, "420 - 520 MHz", "rnode_firmware_tbeam_sx1262.zip", "SX1268"],
0xE8: [850000000, 950000000, 22, "850 - 950 MHz", "rnode_firmware_tbeam_sx1262.zip", "SX1262"],
0xFE: [100000000, 1100000000, 17, "(Band capabilities unknown)", None, "Unknown"],
0xFF: [100000000, 1100000000, 14, "(Band capabilities unknown)", None, "Unknown"],
```
- product should be a code from the following list below without the leading `0x` and in lowercase (example `f0`):
```
PRODUCT_RAK4631 = 0x10
PRODUCT_RNODE = 0x03
PRODUCT_T32_10 = 0xB2
PRODUCT_T32_20 = 0xB0
PRODUCT_T32_21 = 0xB1
PRODUCT_H32_V2 = 0xC0
PRODUCT_H32_V3 = 0xC1
PRODUCT_TBEAM = 0xE0
PRODUCT_HMBRW = 0xF0
```
**Please note**, you must re-compile the firmware each time you make changes **before** you flash it, else you will just be flashing the previous version of the firmware without the new changes!
These commands can also be run as a one liner. For example:

View File

@ -1,47 +1,77 @@
# Board support
If you wish to add support for a specific board to the project, all you have to do (if it's ESP32 or nRF52), is write an additional entry for `Boards.h`.
If you wish to add support for a specific board to the project, all you have to do (if it's ESP32 or nRF52), is write an additional entry for `Boards.h` and `Utilities.h` and the `Makefile` .
This entry should include, at a minimum, the following:
### Boards.h
This entry in `Boards.h` should include, at a minimum, the following:
* whether the device has bluetooth / BLE
* whether the device has a PMU
* whether the device has an EEPROM (false in all cases for nRF52, true for ESP32)
* pin mappings for SPI NSS, SCLK, MOSI, MISO, modem reset and dio0
* the type of modem on the board (if undefined it defaults to SX127x)
* the type of modem on the board
* the number of interfaces (modems)
* whether the modem has a busy pin
* RX and TX leds (preferably LEDs of different colours)
# Check this area...
see https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-spi.h#L39
Effectively, there are multiple SPI buses we can map to pins on these
devices (including the hardware SPI bus)
An example of a minimal entry can be seen below:
You should also define a unique name for your board (with a unique value), for
example:
```
#define BOARD_MY_WICKED_BOARD 0x3B
```
**Check your chosen value is not in use** in `Boards.h` first!
The board definition should look as follows:
```
#elif BOARD_MODEL == BOARD_MY_WICKED_BOARD
#define HAS_BLUETOOTH true
#define HAS_PMU true
#define HAS_EEPROM true
#define EEPROM_SIZE 296 // minimum EEPROM size
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
const int pin_cs = 20;
const int pin_reset = 19;
// const int pin_cs = 1; not needed here
// const int pin_sclk = 2; not needed here
// const int pin_mosi = 3; not needed here
// const int pin_miso = 4; not needed here
const int pin_dio = 18;
// const int pin_busy = 0; not present
const int pin_led_rx = 5;
const int pin_led_tx = 6;
#define HAS_BLUETOOTH false
#define HAS_CONSOLE true
#define HAS_EEPROM true
#define INTERFACE_COUNT 1
const int pin_led_rx = 9;
const int pin_led_tx = 8;
const uint8_t interfaces[INTERFACE_COUNT] = {SX127X};
const bool interface_cfg[INTERFACE_COUNT][3] = {
// SX127X
{
true, // DEFAULT_SPI
false, // HAS_TCXO
false // DIO2_AS_RF_SWITCH
},
};
const int8_t interface_pins[INTERFACE_COUNT][10] = {
// SX127X
{
7, // pin_ss
4, // pin_sclk
6, // pin_mosi
5, // pin_miso
-1, // pin_busy
2, // pin_dio
3, // pin_reset
-1, // pin_txen
-1, // pin_rxen
-1 // pin_tcxo_enable
}
};
```
Note, this will have to be pasted in the section according to the MCU variant,
e.g. nRF52 or ESP32. Find the section by searching for the comparison where
`MCU_VARIANT` is checked for your MCU variant. **Do not change the order of the
pins or options in any of the interface_cfg or interface_pins arrays.** You
have been warned.
[There are multiple SPI
buses](https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-spi.h#L39)
we can map to pins on these devices (including the hardware SPI bus).
In some cases the SPI pins will not be required, as they will be the default pins for the SPI library supporting the board anyway, and therefore do not need overriding in the config.
If the SX1262 is being used the following should also be considered:
* the modem busy pin
* whether DIO2 should be used as the RF switch (DIO2_AS_RF_SWITCH)
* whether an rf on/off switch also has to be operated (through the pin pin_rxen)
* whether a TCXO is connected to the modem (HAS_TCXO)
* the enable pin for the TCXO (if present)
* whether an RF on/off switch also has to be operated (through the pin pin_rxen)
* whether a TCXO is connected to the modem (HAS_TCXO and pin_tcxo_enable to enable the TCXO if present)
* whether the SPI pins are the default used by the SPI library
An example of an entry using the SX1262 modem can be seen below:
```
@ -51,22 +81,34 @@ An example of an entry using the SX1262 modem can be seen below:
#define HAS_EEPROM true
#define EEPROM_SIZE 296 // minimum EEPROM size
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
#define MODEM SX1262
#define DIO2_AS_RF_SWITCH true
#define HAS_TCXO true
#define HAS_BUSY true
const int pin_cs = 20;
const int pin_reset = 19;
const int pin_rxen = 10;
// const int pin_cs = 1; not needed here
// const int pin_sclk = 2; not needed here
// const int pin_mosi = 3; not needed here
// const int pin_miso = 4; not needed here
const int pin_dio = 18;
const int pin_busy = 7;
const int pin_tcxo_enable = -1;
const int pin_led_rx = 5;
const int pin_led_tx = 6;
#define INTERFACE_COUNT 1
const uint8_t interfaces[INTERFACE_COUNT] = {SX126X};
const bool interface_cfg[INTERFACE_COUNT][3] = {
// SX1262
{
false, // DEFAULT_SPI
true, // HAS_TCXO
true // DIO2_AS_RF_SWITCH
}
};
const int8_t interface_pins[INTERFACE_COUNT][10] = {
// SX1262
{
42, // pin_ss
43, // pin_sclk
44, // pin_mosi
45, // pin_miso
46, // pin_busy
47, // pin_dio
38, // pin_reset
-1, // pin_txen
37, // pin_rxen
-1 // pin_tcxo_enable
}
};
```
If the SX1280 is being used, the following should also be added:
@ -80,24 +122,116 @@ An example of an entry using the SX1280 modem can be seen below:
#define HAS_EEPROM true
#define EEPROM_SIZE 296 // minimum EEPROM size
#define EEPROM_OFFSET EEPROM_SIZE-EEPROM_RESERVED
#define MODEM SX1280
#define HAS_BUSY true
#define HAS_RF_SWITCH_RX_TX true
const int pin_cs = 20;
const int pin_reset = 19;
const int pin_rxen = 10;
const int pin_txen = 11;
// const int pin_cs = 1; not needed here
// const int pin_sclk = 2; not needed here
// const int pin_mosi = 3; not needed here
// const int pin_miso = 4; not needed here
const int pin_dio = 18;
const int pin_busy = 7;
const int pin_tcxo_enable = -1;
const int pin_led_rx = 5;
const int pin_led_tx = 6;
#define INTERFACE_COUNT 1
const uint8_t interfaces[INTERFACE_COUNT] = {SX128X};
const bool interface_cfg[INTERFACE_COUNT][3] = {
// SX1280
{
true, // DEFAULT_SPI
false,// HAS_TCXO
false // DIO2_AS_RF_SWITCH
}
};
const int8_t interface_pins[INTERFACE_COUNT][10] = {
// SX1280
{
24, // pin_ss
3, // pin_sclk
30, // pin_mosi
29, // pin_miso
25, // pin_busy
15, // pin_dio
16, // pin_reset
20, // pin_txen
19, // pin_rxen
-1 // pin_tcxo_enable
}
};
```
#### INTERFACE_SPI (nRF52 only)
If you are using non-default SPI pins on an nRF52 MCU variant, you **must** ensure that you add this section to the bottom of your board config:
```
// Required because on nRF52, non-default SPI pins must be initialised when class is declared.
const SPIClass interface_spi[1] = {
// SX1262
SPIClass(
NRF_SPIM2,
interface_pins[0][3],
interface_pins[0][1],
interface_pins[0][2]
)
};
```
This will ensure the pins are set correctly in the SPI class.
### Utilities.h
You should add something similar to the following to drive the LEDs depending on your configuration:
```
#elif BOARD_MODEL == BOARD_MY_WICKED_BOARD
void led_rx_on() { digitalWrite(pin_led_rx, HIGH); }
void led_rx_off() { digitalWrite(pin_led_rx, LOW); }
void led_tx_on() { digitalWrite(pin_led_tx, HIGH); }
void led_tx_off() { digitalWrite(pin_led_tx, LOW); }
```
Note: this will again have to be pasted in the correct section according to
your MCU variant. Please search for the other definitions of `led_rx_on()` to
find the correct section, then find the final section by searching for the
comparison where `MCU_VARIANT` is checked for your MCU variant.
### Makefile
You can add the example target below to the makefile for your board, but **you must replace the FQBN** in the arduino-cli command with the correct one for your board.
```
firmware-wicked_esp32:
arduino-cli compile --fqbn esp32:esp32:esp32c3:CDCOnBoot=cdc -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3B\""
```
Pay attention the the DBOARD_MODEL= value as you must insert the one you chose earlier here.
Another entry to upload to the board. Again substitute your FQBN, and you may have to experiment with the commands to get it to flash:
#### ESP32
```
upload-wicked_esp32:
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32c3
@sleep 1
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32c3/RNode_Firmware_CE.ino.bin)
@sleep 3
python3 ./Release/esptool/esptool.py --chip esp32c3 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
```
#### nRF52
```
upload-wicked_nrf52:
arduino-cli upload -p /dev/ttyACM0 --fqbn rakwireless:nrf52:WisCoreRAK4631Board
unzip -o build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.zip -d build/rakwireless.nrf52.WisCoreRAK4631Board
rnodeconf /dev/ttyACM0 --firmware-hash $$(sha256sum ./build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.bin | grep -o '^\S*')
```
And one final entry to make a release for the firmware:
#### ESP32
```
release-wicked_esp32:
arduino-cli compile --fqbn esp32:esp32:esp32c3:CDCOnBoot=cdc -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3B\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_wicked_esp32.boot_app0
cp build/esp32.esp32.esp32c3/RNode_Firmware_CE.ino.bin build/rnode_firmware_wicked_esp32.bin
cp build/esp32.esp32.esp32c3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_wicked_esp32.bootloader
cp build/esp32.esp32.esp32c3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_wicked_esp32.partitions
zip --junk-paths ./Release/rnode_firmware_wicked_esp32.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_wicked_esp32.boot_app0 build/rnode_firmware_wicked_esp32.bin build/rnode_firmware_wicked_esp32.bootloader build/rnode_firmware_wicked_esp32.partitions
rm -r build
```
#### nRF52
```
release-wicked_nrf52:
arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3B\""
cp build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.hex build/rnode_firmware_wicked_nrf52.hex
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_wicked_nrf52.hex Release/rnode_firmware_wicked_nrf52.zip
```
Don't forget to add this entry to the `release-all` target!
```
release-all: console-site spiffs-image release-tbeam release-tbeam_sx1262 release-lora32_v10 release-lora32_v20 release-lora32_v21 release-lora32_v10_extled release-lora32_v20_extled release-lora32_v21_extled release-lora32_v21_tcxo release-featheresp32 release-genericesp32 ***release-wicked_esp32*** release-heltec32_v2 release-heltec32_v3 release-heltec32_v2_extled release-rnode_ng_20 release-rnode_ng_21 release-t3s3 release-hashes
```
You can of course replace the ESP32 target with the nRF52 target, if you are building for that MCU variant, as seen in previous instructions.
Please submit this, and any other support in different areas of the project your board may require, as a PR for my consideration.
# Feature request

View File

@ -1,4 +1,4 @@
// Copyright (C) 2023, Mark Qvist
// Copyright (C) 2024, Mark Qvist
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -44,6 +44,7 @@
#define CMD_STAT_CHTM 0x25
#define CMD_STAT_PHYPRM 0x26
#define CMD_STAT_BAT 0x27
#define CMD_STAT_CSMA 0x28
#define CMD_BLINK 0x30
#define CMD_RANDOM 0x40
@ -51,10 +52,16 @@
#define CMD_FB_READ 0x42
#define CMD_FB_WRITE 0x43
#define CMD_FB_READL 0x44
#define CMD_DISP_READ 0x66
#define CMD_DISP_INT 0x45
#define CMD_DISP_ADDR 0x63
#define CMD_DISP_BLNK 0x64
#define CMD_DISP_ROT 0x67
#define CMD_DISP_RCND 0x68
#define CMD_NP_INT 0x65
#define CMD_BT_CTRL 0x46
#define CMD_BT_PIN 0x62
#define CMD_DIS_IA 0x69
#define CMD_BOARD 0x47
#define CMD_PLATFORM 0x48
@ -75,32 +82,10 @@
#define CMD_RESET_BYTE 0xF8
#define CMD_INTERFACES 0x64
#define CMD_DATA 0x00
#define CMD_INT0_DATA 0x00
#define CMD_INT1_DATA 0x10
#define CMD_INT2_DATA 0x20
#define CMD_INT3_DATA 0x70
#define CMD_INT4_DATA 0x80
#define CMD_INT5_DATA 0x90
#define CMD_INT6_DATA 0xA0
#define CMD_INT7_DATA 0xB0
#define CMD_INT8_DATA 0xC0
#define CMD_INT9_DATA 0xD0
#define CMD_INT10_DATA 0xE0
#define CMD_INT11_DATA 0xF0
#define CMD_SEL_INT0 0x1E
#define CMD_SEL_INT1 0x1F
#define CMD_SEL_INT2 0x2F
#define CMD_SEL_INT3 0x7F
#define CMD_SEL_INT4 0x8F
#define CMD_SEL_INT5 0x9F
#define CMD_SEL_INT6 0xAF
#define CMD_SEL_INT7 0xBF
#define CMD_SEL_INT8 0xCF
#define CMD_SEL_INT9 0xDF
#define CMD_SEL_INT10 0xEF
#define CMD_SEL_INT11 0xFF
#define CMD_SEL_INT 0x1F
#define DETECT_REQ 0x73
#define DETECT_RESP 0x46
@ -118,6 +103,21 @@
#define ERROR_TXFAILED 0x02
#define ERROR_EEPROM_LOCKED 0x03
#define ERROR_QUEUE_FULL 0x04
#define ERROR_MEMORY_LOW 0x05
#define ERROR_MODEM_TIMEOUT 0x06
#define CMD_GPS 0xA0
#define GPS_CMD_LAT 0x00
#define GPS_CMD_LNG 0x01
// Serial logging
#define LOG_MSG 0x2F
#define MSG_INFO 0x01
#define MSG_ERR 0x02
#define MSG_DBG 0x03
#define MSG_TRACE 0x04
// Serial framing variables
size_t frame_len;

1771
Graphics.h

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
Graphics/Bitmaps/frame.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
Graphics/Bitmaps/plug.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

BIN
Graphics/Design/Text.xcf Normal file

Binary file not shown.

BIN
Graphics/Design/banners.kra Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Graphics/Design/cs.kra Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Graphics/Design/frame.kra Normal file

Binary file not shown.

BIN
Graphics/Design/icons.kra Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Graphics/Design/plug.kra Normal file

Binary file not shown.

BIN
Graphics/Design/r_icon.kra Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,6 @@
#define SX127X 0x00
#define SX1276 0x01
#define SX1278 0x02
#define SX126X 0x10
#define SX1276 0x00
#define SX1278 0x01
#define SX1261 0x10
#define SX1262 0x11
#define SX128X 0x20
#define SX1280 0x21
#define SX1268 0x12
#define SX1280 0x20

482
Makefile
View File

@ -1,4 +1,4 @@
# Copyright (C) 2023, Mark Qvist
# Copyright (C) 2024, Mark Qvist
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -13,364 +13,520 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
ESP_IDF_VER = 2.0.17
# Version 2.0.17 of the Arduino ESP core is based on ESP-IDF v4.4.7
ARDUINO_ESP_CORE_VER = 2.0.17
V ?= 0
VFLAG =
ifeq "$(V)" "1"
VFLAG =-v
endif
COMMON_BUILD_FLAGS = $(VFLAG) -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152"
COMMON_ESP_UPLOAD_FLAGS = $(VFLAG) --chip esp32 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000
all: release
clean:
-rm -r ./build
-rm ./Release/rnode_firmware*
-rm -rf ./build
-rm -f ./Release/rnode_firmware*
prep: prep-avr prep-esp32 prep-samd
prep: prep-esp32 prep-nrf
prep-avr:
prep-index:
arduino-cli core update-index --config-file arduino-cli.yaml
arduino-cli core install arduino:avr --config-file arduino-cli.yaml
arduino-cli core install unsignedio:avr --config-file arduino-cli.yaml
prep-esp32:
arduino-cli core update-index --config-file arduino-cli.yaml
arduino-cli core install esp32:esp32@2.0.17 --config-file arduino-cli.yaml
arduino-cli core install esp32:esp32@$(ARDUINO_ESP_CORE_VER) --config-file arduino-cli.yaml
arduino-cli lib install "Adafruit SSD1306"
arduino-cli lib install "Adafruit SH110X"
arduino-cli lib install "Adafruit ST7735 and ST7789 Library"
arduino-cli lib install "Adafruit NeoPixel"
arduino-cli lib install "XPowersLib"
arduino-cli lib install "Crypto"
prep-samd:
arduino-cli core update-index --config-file arduino-cli.yaml
arduino-cli core install adafruit:samd --config-file arduino-cli.yaml
arduino-cli lib install "Adafruit NeoPixel"
pip install pyserial rns --upgrade --user --break-system-packages # This looks scary, but it's actually just telling pip to install packages as a user instead of trying to install them systemwide, which bypasses the "externally managed environment" error.
prep-nrf:
arduino-cli core update-index --config-file arduino-cli.yaml
arduino-cli core install adafruit:nrf52 --config-file arduino-cli.yaml
arduino-cli core install rakwireless:nrf52 --config-file arduino-cli.yaml
arduino-cli core install Heltec_nRF52:Heltec_nRF52 --config-file arduino-cli.yaml
arduino-cli lib install "Crypto"
arduino-cli lib install "Adafruit GFX Library"
arduino-cli lib install "GxEPD2"
pip install adafruit-nrfutil --upgrade
arduino-cli lib install "TinyGPSPlus"
arduino-cli config set library.enable_unsafe_install true
arduino-cli lib install --git-url https://github.com/liamcottle/esp8266-oled-ssd1306#e16cee124fe26490cb14880c679321ad8ac89c95
pip install pyserial rns --upgrade --user --break-system-packages # This looks scary, but it's actually just telling pip to install packages as a user instead of trying to install them systemwide, which bypasses the "externally managed environment" error.
pip install adafruit-nrfutil --upgrade --user --break-system-packages # This looks scary, but it's actually just telling pip to install packages as a user instead of trying to install them systemwide, which bypasses the "externally managed environment" error.
console-site:
make -C Console clean site
spiffs: console-site spiffs-image
spiffs: console-site spiffs-image
spiffs-image:
python Release/esptool/spiffsgen.py 1966080 ./Console/build Release/console_image.bin
python3 Release/esptool/spiffsgen.py 1966080 ./Console/build Release/console_image.bin
upload-spiffs:
@echo Deploying SPIFFS image...
python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
python ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) $(COMMON_UPLOAD_FLAGS) ./Release/console_image.bin
firmware:
arduino-cli compile --fqbn unsignedio:avr:rnode
firmware: $(shell grep ^firmware- Makefile | cut -d: -f1)
firmware-mega2560:
arduino-cli compile --fqbn arduino:avr:mega
check_bt_buffers:
@./esp32_btbufs.py ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/libraries/BluetoothSerial/src/BluetoothSerial.cpp
firmware-tbeam:
arduino-cli compile --fqbn esp32:esp32:t-beam -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\""
firmware-tbeam: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:t-beam $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\" \"-DBOARD_VARIANT=0xE4\""
firmware-tbeam_sx126x:
arduino-cli compile --fqbn esp32:esp32:t-beam -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\" \"-DMODEM=0x03\""
firmware-tbeam_sx1262: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:t-beam $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\" \"-DBOARD_VARIANT=0xE8\""
firmware-techo:
arduino-cli compile --fqbn adafruit:nrf52:pca10056 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x44\""
firmware-t3s3:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\""
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DBOARD_VARIANT=0xAB\""
firmware-lora32_v10:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x39\""
firmware-t3s3_sx126x:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DBOARD_VARIANT=0xA1\""
firmware-lora32_v10_extled:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x39\" \"-DEXTERNAL_LEDS=true\""
firmware-t3s3_sx1280_pa:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DBOARD_VARIANT=0xAC\""
firmware-lora32_v20:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x36\" \"-DEXTERNAL_LEDS=true\""
firmware-e22_esp32:
arduino-cli compile --fqbn esp32:esp32:esp32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x45\" \"-DEXTERNAL_LEDS=true\""
firmware-lora32_v21:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\""
firmware-lora32_v10: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x39\""
firmware-lora32_v21_extled:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DEXTERNAL_LEDS=true\""
firmware-lora32_v10_extled: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x39\" \"-DEXTERNAL_LEDS=true\""
firmware-lora32_v21_tcxo:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DENABLE_TCXO=true\""
firmware-lora32_v20: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x36\" \"-DEXTERNAL_LEDS=true\""
firmware-heltec32_v2:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\""
firmware-lora32_v21: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\""
firmware-heltec32_v2_extled:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\" \"-DEXTERNAL_LEDS=true\""
firmware-lora32_v21_extled: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DEXTERNAL_LEDS=true\""
firmware-lora32_v21_tcxo: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DENABLE_TCXO=true\""
firmware-heltec32_v2: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\""
firmware-heltec32_v2_extled: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\" \"-DEXTERNAL_LEDS=true\""
firmware-heltec32_v3:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V3 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3A\""
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V3 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3A\""
firmware-rnode_ng_20:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x40\""
firmware-heltec_w_paper:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V3 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3E\""
firmware-rnode_ng_21:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x41\""
firmware-xiao_esp32s3:
arduino-cli compile --fqbn esp32:esp32:XIAO_ESP32S3 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3E\""
firmware-featheresp32:
arduino-cli compile --fqbn esp32:esp32:featheresp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\""
firmware-rnode_ng_20: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x40\""
firmware-genericesp32:
arduino-cli compile --fqbn esp32:esp32:esp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x35\""
firmware-rnode_ng_21: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x41\""
firmware-featheresp32: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:featheresp32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\""
firmware-genericesp32: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:esp32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x35\""
firmware-rak4631:
arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\""
arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\" \"-DBOARD_VARIANT=0x12\""
upload:
arduino-cli upload -p /dev/ttyUSB0 --fqbn unsignedio:avr:rnode
firmware-rak4631_sx1280:
arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\" \"-DBOARD_VARIANT=0x14\""
upload-mega2560:
arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:avr:mega
firmware-opencom-xl:
arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x52\" \"-DBOARD_VARIANT=0x21\""
firmware-heltec_t114:
arduino-cli compile --log --fqbn Heltec_nRF52:Heltec_nRF52:HT-n5262 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3C\""
firmware-heltec_t114_gps:
arduino-cli compile --log --fqbn Heltec_nRF52:Heltec_nRF52:HT-n5262 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3C\" \"-DBOARD_VARIANT=0xCB\""
upload-tbeam:
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:t-beam
@sleep 1
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.t-beam/RNode_Firmware_CE.ino.bin)
@sleep 3
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) $(COMMON_ESP_UPLOAD_FLAGS) ./Release/console_image.bin
upload-tbeam_sx1262:
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:t-beam
@sleep 1
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.t-beam/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
#@sleep 3
#python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
upload-lora32_v10:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:ttgo-lora32
arduino-cli upload -p $(or $(port), /dev/ttyUSB0) --fqbn esp32:esp32:ttgo-lora32
@sleep 1
rnodeconf /dev/ttyUSB0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin)
rnodeconf $(or $(port), /dev/ttyUSB0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyUSB0) $(COMMON_ESP_UPLOAD_FLAGS) ./Release/console_image.bin
upload-lora32_v20:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:ttgo-lora32
arduino-cli upload -p $(or $(port), /dev/ttyUSB0) --fqbn esp32:esp32:ttgo-lora32
@sleep 1
rnodeconf /dev/ttyUSB0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin)
rnodeconf $(or $(port), /dev/ttyUSB0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyUSB0) $(COMMON_ESP_UPLOAD_FLAGS) ./Release/console_image.bin
upload-lora32_v21:
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:ttgo-lora32
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:ttgo-lora32
@sleep 1
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin)
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) $(COMMON_ESP_UPLOAD_FLAGS) ./Release/console_image.bin
upload-heltec32_v2:
arduino-cli upload -p /dev/ttyUSB1 --fqbn esp32:esp32:heltec_wifi_lora_32_V2
arduino-cli upload -p $(or $(port), /dev/ttyUSB0) --fqbn esp32:esp32:heltec_wifi_lora_32_V2
@sleep 1
rnodeconf /dev/ttyUSB1 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware_CE.ino.bin)
rnodeconf $(or $(port), /dev/ttyUSB0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyUSB1 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyUSB0) $(COMMON_ESP_UPLOAD_FLAGS) ./Release/console_image.bin
upload-heltec32_v3:
arduino-cli upload -p /dev/ttyUSB1 --fqbn esp32:esp32:heltec_wifi_lora_32_V3
upload-heltec_w_paper upload-heltec32_v3:
arduino-cli upload -p $(or $(port), /dev/ttyUSB0) --fqbn esp32:esp32:heltec_wifi_lora_32_V3
@sleep 1
rnodeconf /dev/ttyUSB1 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware_CE.ino.bin)
rnodeconf $(or $(port), /dev/ttyUSB0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --chip esp32-s3 --port /dev/ttyUSB1 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyUSB0) --chip esp32-s3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
upload-xiao_esp32s3:
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:XIAO_ESP32S3
@sleep 1
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.XIAO_ESP32S3/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) --chip esp32-s3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 8MB 0x210000 ./Release/console_image.bin
upload-tdeck:
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:esp32s3
@sleep 1
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) --chip esp32-s3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
upload-tbeam_supreme:
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:esp32s3
@sleep 1
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) --chip esp32-s3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
upload-rnode_ng_20:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:ttgo-lora32
arduino-cli upload -p $(or $(port), /dev/ttyUSB0) --fqbn esp32:esp32:ttgo-lora32
@sleep 1
rnodeconf /dev/ttyUSB0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin)
rnodeconf $(or $(port), /dev/ttyUSB0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyUSB0) $(COMMON_ESP_UPLOAD_FLAGS) ./Release/console_image.bin
upload-rnode_ng_21:
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:ttgo-lora32
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:ttgo-lora32
@sleep 1
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin)
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) $(COMMON_ESP_UPLOAD_FLAGS) ./Release/console_image.bin
upload-t3s3:
@echo
@echo Put board into flashing mode by holding BOOT button while momentarily pressing the RESET button. Hit enter when done.
@read
arduino-cli upload -p /dev/ttyACM0 --fqbn esp32:esp32:esp32s3
@sleep 2
python ./Release/esptool/esptool.py --chip esp32s3 --port /dev/ttyACM0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
@echo
@echo Press the RESET button on the board now, and hit enter
@read
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:esp32s3
@sleep 1
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin)
python ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) --chip esp32-s3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
@sleep 3
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin)
upload-featheresp32:
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:featheresp32
arduino-cli upload -p $(or $(port), /dev/ttyUSB0) --fqbn esp32:esp32:featheresp32
@sleep 1
rnodeconf /dev/ttyUSB0 --firmware-hash $$(./partition_hashes ./build/esp32.esp32.featheresp32/RNode_Firmware_CE.ino.bin)
rnodeconf $(or $(port), /dev/ttyUSB0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.featheresp32/RNode_Firmware_CE.ino.bin)
@sleep 3
python ./Release/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
python ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyUSB0) $(COMMON_UPLOAD_FLAGS) ./Release/console_image.bin
upload-rak4631:
arduino-cli upload -p /dev/ttyACM0 --fqbn rakwireless:nrf52:WisCoreRAK4631Board
upload-opencom-xl upload-rak4631:
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn rakwireless:nrf52:WisCoreRAK4631Board
unzip -o build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.zip -d build/rakwireless.nrf52.WisCoreRAK4631Board
rnodeconf /dev/ttyACM0 --firmware-hash $$(sha256sum ./build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.bin | grep -o '^\S*')
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(sha256sum ./build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.bin | grep -o '^\S*')
upload-e22_esp32:
arduino-cli upload -p $(or $(port), /dev/ttyUSB0) --fqbn esp32:esp32:esp32
@sleep 1
rnodeconf $(or $(port), /dev/ttyUSB0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32/RNode_Firmware_CE.ino.bin)
@sleep 3
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyUSB0) $(COMMON_ESP_UPLOAD_FLAGS) ./Release/console_image.bin
upload-heltec_t114:
arduino-cli upload -p /dev/ttyACM0 --fqbn Heltec_nRF52:Heltec_nRF52:HT-n5262
@sleep 1
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes from_device /dev/ttyACM0)
release: release-all
upload-techo:
arduino-cli upload -p /dev/ttyACM0 --fqbn adafruit:nrf52:pca10056
@sleep 6
rnodeconf /dev/ttyACM0 --firmware-hash $$(./partition_hashes from_device /dev/ttyACM0)
release-all: console-site spiffs-image release-tbeam release-tbeam_sx1262 release-lora32_v10 release-lora32_v20 release-lora32_v21 release-lora32_v10_extled release-lora32_v20_extled release-lora32_v21_extled release-lora32_v21_tcxo release-featheresp32 release-genericesp32 release-heltec32_v2 release-heltec32_v3 release-heltec32_v2_extled release-rnode_ng_20 release-rnode_ng_21 release-t3s3 release-hashes
release: console-site spiffs-image $(shell grep ^release- Makefile | cut -d: -f1)
release-hashes:
python ./release_hashes.py > ./Release/release.json
python3 ./release_hashes.py > ./Release/release.json
release-tbeam:
arduino-cli compile --fqbn esp32:esp32:t-beam -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_tbeam.boot_app0
release-tbeam: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:t-beam $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\" \"-DBOARD_VARIANT=0xE4\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_tbeam.boot_app0
cp build/esp32.esp32.t-beam/RNode_Firmware_CE.ino.bin build/rnode_firmware_tbeam.bin
cp build/esp32.esp32.t-beam/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_tbeam.bootloader
cp build/esp32.esp32.t-beam/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_tbeam.partitions
zip --junk-paths ./Release/rnode_firmware_tbeam.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_tbeam.boot_app0 build/rnode_firmware_tbeam.bin build/rnode_firmware_tbeam.bootloader build/rnode_firmware_tbeam.partitions
rm -r build
release-tbeam_sx1262:
arduino-cli compile --fqbn esp32:esp32:t-beam -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\" \"-DMODEM=0x03\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_tbeam_sx1262.boot_app0
release-tbeam_sx1262: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:t-beam $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x33\" \"-DBOARD_VARIANT=0xE8\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_tbeam_sx1262.boot_app0
cp build/esp32.esp32.t-beam/RNode_Firmware_CE.ino.bin build/rnode_firmware_tbeam_sx1262.bin
cp build/esp32.esp32.t-beam/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_tbeam_sx1262.bootloader
cp build/esp32.esp32.t-beam/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_tbeam_sx1262.partitions
zip --junk-paths ./Release/rnode_firmware_tbeam_sx1262.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_tbeam_sx1262.boot_app0 build/rnode_firmware_tbeam_sx1262.bin build/rnode_firmware_tbeam_sx1262.bootloader build/rnode_firmware_tbeam_sx1262.partitions
rm -r build
release-lora32_v10:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x39\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v10.boot_app0
release-lora32_v10: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x39\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v10.boot_app0
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin build/rnode_firmware_lora32v10.bin
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_lora32v10.bootloader
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_lora32v10.partitions
zip --junk-paths ./Release/rnode_firmware_lora32v10.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v10.boot_app0 build/rnode_firmware_lora32v10.bin build/rnode_firmware_lora32v10.bootloader build/rnode_firmware_lora32v10.partitions
rm -r build
release-lora32_v20:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x36\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v20.boot_app0
release-lora32_v20: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x36\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v20.boot_app0
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin build/rnode_firmware_lora32v20.bin
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_lora32v20.bootloader
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_lora32v20.partitions
zip --junk-paths ./Release/rnode_firmware_lora32v20.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v20.boot_app0 build/rnode_firmware_lora32v20.bin build/rnode_firmware_lora32v20.bootloader build/rnode_firmware_lora32v20.partitions
rm -r build
release-lora32_v21:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v21.boot_app0
release-lora32_v21: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v21.boot_app0
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin build/rnode_firmware_lora32v21.bin
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_lora32v21.bootloader
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_lora32v21.partitions
zip --junk-paths ./Release/rnode_firmware_lora32v21.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v21.boot_app0 build/rnode_firmware_lora32v21.bin build/rnode_firmware_lora32v21.bootloader build/rnode_firmware_lora32v21.partitions
rm -r build
release-lora32_v10_extled:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x39\" \"-DEXTERNAL_LEDS=true\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v10.boot_app0
release-lora32_v10_extled: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x39\" \"-DEXTERNAL_LEDS=true\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v10.boot_app0
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin build/rnode_firmware_lora32v10.bin
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_lora32v10.bootloader
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_lora32v10.partitions
zip --junk-paths ./Release/rnode_firmware_lora32v10.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v10.boot_app0 build/rnode_firmware_lora32v10.bin build/rnode_firmware_lora32v10.bootloader build/rnode_firmware_lora32v10.partitions
rm -r build
release-lora32_v20_extled:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x36\" \"-DEXTERNAL_LEDS=true\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v20.boot_app0
release-lora32_v20_extled: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x36\" \"-DEXTERNAL_LEDS=true\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v20.boot_app0
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin build/rnode_firmware_lora32v20.bin
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_lora32v20.bootloader
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_lora32v20.partitions
zip --junk-paths ./Release/rnode_firmware_lora32v20_extled.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v20.boot_app0 build/rnode_firmware_lora32v20.bin build/rnode_firmware_lora32v20.bootloader build/rnode_firmware_lora32v20.partitions
rm -r build
release-lora32_v21_extled:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DEXTERNAL_LEDS=true\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v21.boot_app0
release-lora32_v21_extled: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DEXTERNAL_LEDS=true\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v21.boot_app0
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin build/rnode_firmware_lora32v21.bin
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_lora32v21.bootloader
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_lora32v21.partitions
zip --junk-paths ./Release/rnode_firmware_lora32v21_extled.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v21.boot_app0 build/rnode_firmware_lora32v21.bin build/rnode_firmware_lora32v21.bootloader build/rnode_firmware_lora32v21.partitions
rm -r build
release-lora32_v21_tcxo:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DENABLE_TCXO=true\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v21_tcxo.boot_app0
release-lora32_v21_tcxo: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x37\" \"-DENABLE_TCXO=true\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_lora32v21_tcxo.boot_app0
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin build/rnode_firmware_lora32v21_tcxo.bin
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_lora32v21_tcxo.bootloader
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_lora32v21_tcxo.partitions
zip --junk-paths ./Release/rnode_firmware_lora32v21_tcxo.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_lora32v21_tcxo.boot_app0 build/rnode_firmware_lora32v21_tcxo.bin build/rnode_firmware_lora32v21_tcxo.bootloader build/rnode_firmware_lora32v21_tcxo.partitions
rm -r build
release-heltec32_v2:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_heltec32v2.boot_app0
release-heltec32_v2: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_heltec32v2.boot_app0
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware_CE.ino.bin build/rnode_firmware_heltec32v2.bin
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_heltec32v2.bootloader
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_heltec32v2.partitions
zip --junk-paths ./Release/rnode_firmware_heltec32v2.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_heltec32v2.boot_app0 build/rnode_firmware_heltec32v2.bin build/rnode_firmware_heltec32v2.bootloader build/rnode_firmware_heltec32v2.partitions
rm -r build
release-heltec32_v3:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V3 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3A\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_heltec32v3.boot_app0
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V3 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3A\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_heltec32v3.boot_app0
cp build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware_CE.ino.bin build/rnode_firmware_heltec32v3.bin
cp build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_heltec32v3.bootloader
cp build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_heltec32v3.partitions
zip --junk-paths ./Release/rnode_firmware_heltec32v3.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_heltec32v3.boot_app0 build/rnode_firmware_heltec32v3.bin build/rnode_firmware_heltec32v3.bootloader build/rnode_firmware_heltec32v3.partitions
rm -r build
release-heltec32_v2_extled:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\" \"-DEXTERNAL_LEDS=true\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_heltec32v2.boot_app0
release-heltec_w_paper:
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V3 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3E\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_heltecwpaper.boot_app0
cp build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware_CE.ino.bin build/rnode_firmware_heltecwpaper.bin
cp build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_heltecwpaper.bootloader
cp build/esp32.esp32.heltec_wifi_lora_32_V3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_heltecwpaper.partitions
zip --junk-paths ./Release/rnode_firmware_heltecwpaper.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_heltecwpaper.boot_app0 build/rnode_firmware_heltecwpaper.bin build/rnode_firmware_heltecwpaper.bootloader build/rnode_firmware_heltecwpaper.partitions
rm -r build
release-xiao_esp32s3:
arduino-cli compile --fqbn esp32:esp32:XIAO_ESP32S3 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3E\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_xiao_esp32s3.boot_app0
cp build/esp32.esp32.XIAO_ESP32S3/RNode_Firmware_CE.ino.bin build/rnode_firmware_xiao_esp32s3.bin
cp build/esp32.esp32.XIAO_ESP32S3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_xiao_esp32s3.bootloader
cp build/esp32.esp32.XIAO_ESP32S3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_xiao_esp32s3.partitions
zip --junk-paths ./Release/rnode_firmware_xiao_esp32s3.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_xiao_esp32s3.boot_app0 build/rnode_firmware_xiao_esp32s3.bin build/rnode_firmware_xiao_esp32s3.bootloader build/rnode_firmware_xiao_esp32s3.partitions
rm -r build
release-heltec32_v2_extled: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:heltec_wifi_lora_32_V2 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x38\" \"-DEXTERNAL_LEDS=true\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_heltec32v2.boot_app0
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware_CE.ino.bin build/rnode_firmware_heltec32v2.bin
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_heltec32v2.bootloader
cp build/esp32.esp32.heltec_wifi_lora_32_V2/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_heltec32v2.partitions
zip --junk-paths ./Release/rnode_firmware_heltec32v2.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_heltec32v2.boot_app0 build/rnode_firmware_heltec32v2.bin build/rnode_firmware_heltec32v2.bootloader build/rnode_firmware_heltec32v2.partitions
rm -r build
release-rnode_ng_20:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x40\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_ng20.boot_app0
release-rnode_ng_20: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x40\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_ng20.boot_app0
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin build/rnode_firmware_ng20.bin
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_ng20.bootloader
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_ng20.partitions
zip --junk-paths ./Release/rnode_firmware_ng20.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_ng20.boot_app0 build/rnode_firmware_ng20.bin build/rnode_firmware_ng20.bootloader build/rnode_firmware_ng20.partitions
rm -r build
release-rnode_ng_21:
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x41\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_ng21.boot_app0
release-rnode_ng_21: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:ttgo-lora32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x41\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_ng21.boot_app0
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bin build/rnode_firmware_ng21.bin
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_ng21.bootloader
cp build/esp32.esp32.ttgo-lora32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_ng21.partitions
zip --junk-paths ./Release/rnode_firmware_ng21.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_ng21.boot_app0 build/rnode_firmware_ng21.bin build/rnode_firmware_ng21.bootloader build/rnode_firmware_ng21.partitions
rm -r build
release-t3s3:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_t3s3.boot_app0
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_t3s3.bin
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_t3s3.bootloader
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_t3s3.partitions
zip --junk-paths ./Release/rnode_firmware_t3s3.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3.boot_app0 build/rnode_firmware_t3s3.bin build/rnode_firmware_t3s3.bootloader build/rnode_firmware_t3s3.partitions
release-techo:
arduino-cli compile --fqbn adafruit:nrf52:pca10056 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x44\""
cp build/adafruit.nrf52.pca10056/RNode_Firmware_CE.ino.hex build/rnode_firmware_techo.hex
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_techo.hex Release/rnode_firmware_techo.zip
rm -r build
release-featheresp32:
arduino-cli compile --fqbn esp32:esp32:featheresp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_featheresp32.boot_app0
release-t3s3:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DBOARD_VARIANT=0xA1\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_t3s3_sx126x.boot_app0
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_t3s3_sx126x.bin
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_t3s3_sx126x.bootloader
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_t3s3_sx126x.partitions
zip --junk-paths ./Release/rnode_firmware_t3s3_sx126x.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx126x.boot_app0 build/rnode_firmware_t3s3_sx126x.bin build/rnode_firmware_t3s3_sx126x.bootloader build/rnode_firmware_t3s3_sx126x.partitions
rm -r build
release-t3s3_sx127x:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DBOARD_VARIANT=0xA5\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_t3s3_sx127x.boot_app0
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_t3s3_sx127x.bin
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_t3s3_sx127x.bootloader
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_t3s3_sx127x.partitions
zip --junk-paths ./Release/rnode_firmware_t3s3_sx127x.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx127x.boot_app0 build/rnode_firmware_t3s3_sx127x.bin build/rnode_firmware_t3s3_sx127x.bootloader build/rnode_firmware_t3s3_sx127x.partitions
rm -r build
release-t3s3_sx1280_pa:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x42\" \"-DBOARD_VARIANT=0xAC\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_t3s3_sx1280_pa.boot_app0
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_t3s3_sx1280_pa.bin
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_t3s3_sx1280_pa.bootloader
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_t3s3_sx1280_pa.partitions
zip --junk-paths ./Release/rnode_firmware_t3s3_sx1280_pa.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx1280_pa.boot_app0 build/rnode_firmware_t3s3_sx1280_pa.bin build/rnode_firmware_t3s3_sx1280_pa.bootloader build/rnode_firmware_t3s3_sx1280_pa.partitions
rm -r build
release-e22_esp32:
arduino-cli compile --fqbn esp32:esp32:esp32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x45\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_esp32_e22.boot_app0
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.bin build/rnode_firmware_esp32_e22.bin
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_esp32_e22.bootloader
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_esp32_e22.partitions
zip --junk-paths ./Release/rnode_firmware_esp32_e22.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_esp32_e22.boot_app0 build/rnode_firmware_esp32_e22.bin build/rnode_firmware_esp32_e22.bootloader build/rnode_firmware_esp32_e22.partitions
rm -r build
release-tdeck:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3B\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_tdeck.boot_app0
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_tdeck.bin
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_tdeck.bootloader
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_tdeck.partitions
zip --junk-paths ./Release/rnode_firmware_tdeck.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_tdeck.boot_app0 build/rnode_firmware_tdeck.bin build/rnode_firmware_tdeck.bootloader build/rnode_firmware_tdeck.partitions
rm -r build
release-tbeam_supreme:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3D\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_tbeam_supreme.boot_app0
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin build/rnode_firmware_tbeam_supreme.bin
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_tbeam_supreme.bootloader
cp build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_tbeam_supreme.partitions
zip --junk-paths ./Release/rnode_firmware_tbeam_supreme.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_tbeam_supreme.boot_app0 build/rnode_firmware_tbeam_supreme.bin build/rnode_firmware_tbeam_supreme.bootloader build/rnode_firmware_tbeam_supreme.partitions
rm -r build
release-featheresp32: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:featheresp32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x34\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_featheresp32.boot_app0
cp build/esp32.esp32.featheresp32/RNode_Firmware_CE.ino.bin build/rnode_firmware_featheresp32.bin
cp build/esp32.esp32.featheresp32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_featheresp32.bootloader
cp build/esp32.esp32.featheresp32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_featheresp32.partitions
zip --junk-paths ./Release/rnode_firmware_featheresp32.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_featheresp32.boot_app0 build/rnode_firmware_featheresp32.bin build/rnode_firmware_featheresp32.bootloader build/rnode_firmware_featheresp32.partitions
rm -r build
release-genericesp32:
arduino-cli compile --fqbn esp32:esp32:esp32 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x35\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ESP_IDF_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_esp32_generic.boot_app0
release-genericesp32: check_bt_buffers
arduino-cli compile --fqbn esp32:esp32:esp32 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x35\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_esp32_generic.boot_app0
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.bin build/rnode_firmware_esp32_generic.bin
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_esp32_generic.bootloader
cp build/esp32.esp32.esp32/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_esp32_generic.partitions
zip --junk-paths ./Release/rnode_firmware_esp32_generic.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_esp32_generic.boot_app0 build/rnode_firmware_esp32_generic.bin build/rnode_firmware_esp32_generic.bootloader build/rnode_firmware_esp32_generic.partitions
rm -r build
release-mega2560:
arduino-cli compile --fqbn arduino:avr:mega -e --build-property "compiler.cpp.extra_flags=\"-DMODEM=0x01\""
cp build/arduino.avr.mega/RNode_Firmware_CE.ino.hex Release/rnode_firmware_m2560.hex
rm -r build
release-rak4631:
arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\""
arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\" \"-DBOARD_VARIANT=0x12\""
cp build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.hex build/rnode_firmware_rak4631.hex
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_rak4631.hex Release/rnode_firmware_rak4631.zip
rm -r build
release-rak4631_sx1280:
arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x51\" \"-DBOARD_VARIANT=0x14\""
cp build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.hex build/rnode_firmware_rak4631_sx1280.hex
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_rak4631_sx1280.hex Release/rnode_firmware_rak4631_sx1280.zip
rm -r build
release-opencom-xl:
arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x52\" \"-DBOARD_VARIANT=0x21\""
cp build/rakwireless.nrf52.WisCoreRAK4631Board/RNode_Firmware_CE.ino.hex build/rnode_firmware_opencom_xl.hex
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_opencom_xl.hex Release/rnode_firmware_opencom_xl.zip
rm -r build
release-heltec_t114:
arduino-cli compile --fqbn Heltec_nRF52:Heltec_nRF52:HT-n5262 $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3C\""
cp build/Heltec_nRF52.Heltec_nRF52.HT-n5262/RNode_Firmware_CE.ino.hex build/rnode_firmware_heltec_t114.hex
adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/rnode_firmware_heltec_t114.hex Release/rnode_firmware_heltec_t114.zip
rm -r build

323
Power.h
View File

@ -1,9 +1,28 @@
#if BOARD_MODEL == BOARD_TBEAM
// Copyright (C) 2024, Mark Qvist
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#if BOARD_MODEL == BOARD_TBEAM || BOARD_MODEL == BOARD_TBEAM_S_V1
#include <XPowersLib.h>
XPowersLibInterface* PMU = NULL;
#ifndef PMU_WIRE_PORT
#define PMU_WIRE_PORT Wire
#if BOARD_MODEL == BOARD_TBEAM_S_V1
#define PMU_WIRE_PORT Wire1
#else
#define PMU_WIRE_PORT Wire
#endif
#endif
#define BAT_V_MIN 3.15
@ -28,8 +47,6 @@
pmuInterrupt = true;
}
#elif BOARD_MODEL == BOARD_RNODE_NG_21 || BOARD_MODEL == BOARD_LORA32_V2_1
#define BAT_C_SAMPLES 7
#define BAT_D_SAMPLES 2
#define BAT_V_MIN 3.15
#define BAT_V_MAX 4.3
#define BAT_V_CHG 4.48
@ -44,26 +61,109 @@
int bat_charged_samples = 0;
bool bat_voltage_dropping = false;
float bat_delay_v = 0;
#elif BOARD_MODEL == BOARD_RAK4631
#include "nrfx_power.h"
#define BAT_C_SAMPLES 7
#define BAT_D_SAMPLES 2
#define BAT_V_MIN 2.75
#define BAT_V_MAX 4.2
#define BAT_V_FLOAT 4.22
#define BAT_SAMPLES 5
#define VBAT_MV_PER_LSB (0.73242188F) // 3.0V ADC range and 12 - bit ADC resolution = 3000mV / 4096
#define VBAT_DIVIDER_COMP (1.73) // Compensation factor for the VBAT divider
#define VBAT_MV_PER_LSB_FIN (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
#define PIN_VBAT WB_A0
float bat_p_samples[BAT_SAMPLES];
float bat_v_samples[BAT_SAMPLES];
uint8_t bat_samples_count = 0;
int bat_discharging_samples = 0;
int bat_charging_samples = 0;
int bat_charged_samples = 0;
bool bat_voltage_dropping = false;
float bat_delay_v = 0;
float bat_state_change_v = 0;
#elif BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL
#include "nrfx_power.h"
#define BAT_C_SAMPLES 7
#define BAT_D_SAMPLES 2
#define BAT_V_MIN 2.75
#define BAT_V_MAX 4.2
#define BAT_V_FLOAT 4.22
#define BAT_SAMPLES 5
#define VBAT_MV_PER_LSB (0.73242188F) // 3.0V ADC range and 12 - bit ADC resolution = 3000mV / 4096
#define VBAT_DIVIDER_COMP (1.73) // Compensation factor for the VBAT divider
#define VBAT_MV_PER_LSB_FIN (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
#define PIN_VBAT WB_A0
float bat_p_samples[BAT_SAMPLES];
float bat_v_samples[BAT_SAMPLES];
uint8_t bat_samples_count = 0;
int bat_discharging_samples = 0;
int bat_charging_samples = 0;
int bat_charged_samples = 0;
bool bat_voltage_dropping = false;
float bat_delay_v = 0;
#elif BOARD_MODEL == BOARD_T3S3
#define BAT_V_MIN 3.15
#define BAT_V_MAX 4.217
#define BAT_V_CHG 4.48
#define BAT_V_FLOAT 4.33
#define BAT_SAMPLES 5
const uint8_t pin_vbat = 1;
float bat_p_samples[BAT_SAMPLES];
float bat_v_samples[BAT_SAMPLES];
uint8_t bat_samples_count = 0;
int bat_discharging_samples = 0;
int bat_charging_samples = 0;
int bat_charged_samples = 0;
bool bat_voltage_dropping = false;
float bat_delay_v = 0;
float bat_state_change_v = 0;
#elif BOARD_MODEL == BOARD_TDECK
#define BAT_V_MIN 3.15
#define BAT_V_MAX 4.3
#define BAT_V_CHG 4.48
#define BAT_V_FLOAT 4.33
#define BAT_SAMPLES 5
const uint8_t pin_vbat = 4;
float bat_p_samples[BAT_SAMPLES];
float bat_v_samples[BAT_SAMPLES];
uint8_t bat_samples_count = 0;
int bat_discharging_samples = 0;
int bat_charging_samples = 0;
int bat_charged_samples = 0;
bool bat_voltage_dropping = false;
float bat_delay_v = 0;
float bat_state_change_v = 0;
#elif BOARD_MODEL == BOARD_HELTEC32_V3
#define BAT_V_MIN 3.15
#define BAT_V_MAX 4.3
#define BAT_V_CHG 4.48
#define BAT_V_FLOAT 4.33
#define BAT_SAMPLES 7
const uint8_t pin_vbat = 1;
const uint8_t pin_ctrl = 37;
float bat_p_samples[BAT_SAMPLES];
float bat_v_samples[BAT_SAMPLES];
uint8_t bat_samples_count = 0;
int bat_discharging_samples = 0;
int bat_charging_samples = 0;
int bat_charged_samples = 0;
bool bat_voltage_dropping = false;
float bat_delay_v = 0;
float bat_state_change_v = 0;
#elif BOARD_MODEL == BOARD_HELTEC_T114
#define BAT_V_MIN 3.15
#define BAT_V_MAX 4.165
#define BAT_V_CHG 4.48
#define BAT_V_FLOAT 4.33
#define BAT_SAMPLES 7
const uint8_t pin_vbat = 4;
const uint8_t pin_ctrl = 6;
float bat_p_samples[BAT_SAMPLES];
float bat_v_samples[BAT_SAMPLES];
uint8_t bat_samples_count = 0;
int bat_discharging_samples = 0;
int bat_charging_samples = 0;
int bat_charged_samples = 0;
bool bat_voltage_dropping = false;
float bat_delay_v = 0;
float bat_state_change_v = 0;
#elif BOARD_MODEL == BOARD_TECHO
#define BAT_V_MIN 3.15
#define BAT_V_MAX 4.16
#define BAT_V_CHG 4.48
#define BAT_V_FLOAT 4.33
#define BAT_SAMPLES 7
const uint8_t pin_vbat = 4;
float bat_p_samples[BAT_SAMPLES];
float bat_v_samples[BAT_SAMPLES];
uint8_t bat_samples_count = 0;
int bat_discharging_samples = 0;
int bat_charging_samples = 0;
int bat_charged_samples = 0;
bool bat_voltage_dropping = false;
float bat_delay_v = 0;
float bat_state_change_v = 0;
#endif
uint32_t last_pmu_update = 0;
@ -74,10 +174,23 @@ uint8_t pmu_rc = 0;
void kiss_indicate_battery();
void measure_battery() {
#if BOARD_MODEL == BOARD_RNODE_NG_21 || BOARD_MODEL == BOARD_LORA32_V2_1
#if BOARD_MODEL == BOARD_RNODE_NG_21 || BOARD_MODEL == BOARD_LORA32_V2_1 || BOARD_MODEL == BOARD_HELTEC32_V3 || BOARD_MODEL == BOARD_TDECK || BOARD_MODEL == BOARD_T3S3 || BOARD_MODEL == BOARD_HELTEC_T114 || BOARD_MODEL == BOARD_TECHO
battery_installed = true;
battery_indeterminate = true;
bat_v_samples[bat_samples_count%BAT_SAMPLES] = (float)(analogRead(pin_vbat)) / 4095*2*3.3*1.1;
#if BOARD_MODEL == BOARD_HELTEC32_V3
float battery_measurement = (float)(analogRead(pin_vbat)) * 0.0041;
#elif BOARD_MODEL == BOARD_T3S3
float battery_measurement = (float)(analogRead(pin_vbat)) / 4095.0*6.7828;
#elif BOARD_MODEL == BOARD_HELTEC_T114
float battery_measurement = (float)(analogRead(pin_vbat)) * 0.017165;
#elif BOARD_MODEL == BOARD_TECHO
float battery_measurement = (float)(analogRead(pin_vbat)) * 0.007067;
#else
float battery_measurement = (float)(analogRead(pin_vbat)) / 4095.0*7.26;
#endif
bat_v_samples[bat_samples_count%BAT_SAMPLES] = battery_measurement;
bat_p_samples[bat_samples_count%BAT_SAMPLES] = ((battery_voltage-BAT_V_MIN) / (BAT_V_MAX-BAT_V_MIN))*100.0;
bat_samples_count++;
@ -100,41 +213,61 @@ void measure_battery() {
battery_voltage = battery_voltage/BAT_SAMPLES;
if (bat_delay_v == 0) bat_delay_v = battery_voltage;
if (bat_state_change_v == 0) bat_state_change_v = battery_voltage;
if (battery_percent > 100.0) battery_percent = 100.0;
if (battery_percent < 0.0) battery_percent = 0.0;
if (bat_samples_count%BAT_SAMPLES == 0) {
float bat_delay_diff = bat_state_change_v-battery_voltage;
if (bat_delay_diff < 0) { bat_delay_diff *= -1; }
if (battery_voltage < bat_delay_v && battery_voltage < BAT_V_FLOAT) {
bat_voltage_dropping = true;
if (bat_voltage_dropping == false) {
if (bat_delay_diff > 0.008) {
bat_voltage_dropping = true;
bat_state_change_v = battery_voltage;
// SerialBT.printf("STATE CHANGE to DISCHARGE at delta=%.3fv. State change v is now %.3fv.\n", bat_delay_diff, bat_state_change_v);
}
}
} else {
bat_voltage_dropping = false;
if (bat_voltage_dropping == true) {
if (bat_delay_diff > 0.01) {
bat_voltage_dropping = false;
bat_state_change_v = battery_voltage;
// SerialBT.printf("STATE CHANGE to CHARGE at delta=%.3fv. State change v is now %.3fv.\n", bat_delay_diff, bat_state_change_v);
}
}
}
bat_samples_count = 0;
bat_delay_v = battery_voltage;
}
if (bat_voltage_dropping && battery_voltage < BAT_V_FLOAT) {
battery_state = BATTERY_STATE_DISCHARGING;
} else {
#if BOARD_MODEL == BOARD_RNODE_NG_21
if (battery_percent < 100.0) {
battery_state = BATTERY_STATE_CHARGING;
#else
battery_state = BATTERY_STATE_DISCHARGING;
#endif
} else {
battery_state = BATTERY_STATE_CHARGED;
}
}
#if MCU_VARIANT == MCU_NRF52
if (bt_state != BT_STATE_OFF) { blebas.write(battery_percent); }
#endif
// if (bt_state == BT_STATE_CONNECTED) {
// SerialBT.printf("Bus voltage %.3fv. Unfiltered %.3fv.", battery_voltage, bat_v_samples[BAT_SAMPLES-1]);
// if (bat_voltage_dropping) {
// SerialBT.printf(" Voltage is dropping. Percentage %.1f%%.\n", battery_percent);
// } else {
// SerialBT.print(" Voltage is not dropping.\n");
// }
// if (bat_voltage_dropping) { SerialBT.printf(" Voltage is dropping. Percentage %.1f%%.", battery_percent); }
// else { SerialBT.printf(" Voltage is not dropping. Percentage %.1f%%.", battery_percent); }
// if (battery_state == BATTERY_STATE_DISCHARGING) { SerialBT.printf(" Battery discharging. delay_v %.3fv", bat_delay_v); }
// if (battery_state == BATTERY_STATE_CHARGING) { SerialBT.printf(" Battery charging. delay_v %.3fv", bat_delay_v); }
// if (battery_state == BATTERY_STATE_CHARGED) { SerialBT.print(" Battery is charged."); }
// SerialBT.print("\n");
// }
}
#elif BOARD_MODEL == BOARD_TBEAM
#elif BOARD_MODEL == BOARD_TBEAM || BOARD_MODEL == BOARD_TBEAM_S_V1
if (PMU) {
float discharge_current = 0;
float charge_current = 0;
@ -172,7 +305,7 @@ void measure_battery() {
}
}
} else {
battery_state = BATTERY_STATE_DISCHARGING;
battery_state = BATTERY_STATE_UNKNOWN;
battery_percent = 0.0;
battery_voltage = 0.0;
}
@ -214,7 +347,7 @@ void measure_battery() {
battery_ready = false;
}
#elif BOARD_MODEL == BOARD_RAK4631
#elif BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL
battery_installed = true;
battery_indeterminate = false;
@ -273,6 +406,16 @@ void measure_battery() {
if (battery_percent >= 98) {
battery_state = BATTERY_STATE_CHARGED;
}
#if HAS_BLE
if ((bt_state == BT_STATE_ON) || bt_state == BT_STATE_CONNECTED) {
if (battery_state != BATTERY_STATE_CHARGING) {
blebas.write(battery_percent);
} else {
blebas.write(100);
}
}
#endif
#endif
if (battery_ready) {
@ -291,31 +434,33 @@ void update_pmu() {
}
bool init_pmu() {
#if BOARD_MODEL == BOARD_RNODE_NG_21 || BOARD_MODEL == BOARD_LORA32_V2_1
#if BOARD_MODEL == BOARD_RNODE_NG_21 || BOARD_MODEL == BOARD_LORA32_V2_1 || BOARD_MODEL == BOARD_TDECK || BOARD_MODEL == BOARD_T3S3 || BOARD_MODEL == BOARD_TECHO
pinMode(pin_vbat, INPUT);
return true;
#elif BOARD_MODEL == BOARD_HELTEC32_V3
pinMode(pin_ctrl,OUTPUT);
digitalWrite(pin_ctrl, LOW);
return true;
#elif BOARD_MODEL == BOARD_HELTEC_T114
pinMode(pin_ctrl,OUTPUT);
digitalWrite(pin_ctrl, HIGH);
return true;
#elif BOARD_MODEL == BOARD_TBEAM
Wire.begin(I2C_SDA, I2C_SCL);
if (!PMU) {
PMU = new XPowersAXP2101(PMU_WIRE_PORT);
if (!PMU->init()) {
Serial.println("Warning: Failed to find AXP2101 power management");
delete PMU;
PMU = NULL;
} else {
Serial.println("AXP2101 PMU init succeeded, using AXP2101 PMU");
}
}
if (!PMU) {
PMU = new XPowersAXP192(PMU_WIRE_PORT);
if (!PMU->init()) {
Serial.println("Warning: Failed to find AXP192 power management");
delete PMU;
PMU = NULL;
} else {
Serial.println("AXP192 PMU init succeeded, using AXP192 PMU");
}
}
@ -421,7 +566,7 @@ bool init_pmu() {
PMU->setPowerKeyPressOffTime(XPOWERS_POWEROFF_4S);
return true;
#elif BOARD_MODEL == BOARD_RAK4631
#elif BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL
// board doesn't have PMU but we can measure batt voltage
// prep ADC for reading battery level
@ -436,6 +581,86 @@ bool init_pmu() {
// Get a single ADC sample and throw it away
float raw = analogRead(PIN_VBAT);
return true;
#elif BOARD_MODEL == BOARD_TBEAM_S_V1
Wire1.begin(I2C_SDA, I2C_SCL);
if (!PMU) {
PMU = new XPowersAXP2101(PMU_WIRE_PORT);
if (!PMU->init()) {
delete PMU;
PMU = NULL;
}
}
if (!PMU) {
return false;
}
/**
* gnss module power channel
* The default ALDO4 is off, you need to turn on the GNSS power first, otherwise it will be invalid during
* initialization
*/
PMU->setPowerChannelVoltage(XPOWERS_ALDO4, 3300);
PMU->enablePowerOutput(XPOWERS_ALDO4);
// lora radio power channel
PMU->setPowerChannelVoltage(XPOWERS_ALDO3, 3300);
PMU->enablePowerOutput(XPOWERS_ALDO3);
// m.2 interface
PMU->setPowerChannelVoltage(XPOWERS_DCDC3, 3300);
PMU->enablePowerOutput(XPOWERS_DCDC3);
/**
* ALDO2 cannot be turned off.
* It is a necessary condition for sensor communication.
* It must be turned on to properly access the sensor and screen
* It is also responsible for the power supply of PCF8563
*/
PMU->setPowerChannelVoltage(XPOWERS_ALDO2, 3300);
PMU->enablePowerOutput(XPOWERS_ALDO2);
// 6-axis , magnetometer ,bme280 , oled screen power channel
PMU->setPowerChannelVoltage(XPOWERS_ALDO1, 3300);
PMU->enablePowerOutput(XPOWERS_ALDO1);
// sdcard power channle
PMU->setPowerChannelVoltage(XPOWERS_BLDO1, 3300);
PMU->enablePowerOutput(XPOWERS_BLDO1);
// PMU->setPowerChannelVoltage(XPOWERS_DCDC4, 3300);
// PMU->enablePowerOutput(XPOWERS_DCDC4);
// not use channel
PMU->disablePowerOutput(XPOWERS_DCDC2); // not elicited
PMU->disablePowerOutput(XPOWERS_DCDC5); // not elicited
PMU->disablePowerOutput(XPOWERS_DLDO1); // Invalid power channel, it does not exist
PMU->disablePowerOutput(XPOWERS_DLDO2); // Invalid power channel, it does not exist
PMU->disablePowerOutput(XPOWERS_VBACKUP);
// Configure charging
PMU->setChargeTargetVoltage(XPOWERS_AXP2101_CHG_VOL_4V2);
PMU->setChargerConstantCurr(XPOWERS_AXP2101_CHG_CUR_500MA);
// TODO: Reset
PMU->setChargingLedMode(XPOWERS_CHG_LED_CTRL_CHG);
// Set the time of pressing the button to turn off
PMU->setPowerKeyPressOffTime(XPOWERS_POWEROFF_4S);
PMU->setPowerKeyPressOnTime(XPOWERS_POWERON_128MS);
// disable all axp chip interrupt
PMU->disableIRQ(XPOWERS_AXP2101_ALL_IRQ);
PMU->clearIrqStatus();
// It is necessary to disable the detection function of the TS pin on the board
// without the battery temperature detection function, otherwise it will cause abnormal charging
PMU->disableTSPinMeasure();
PMU->enableVbusVoltageMeasure();
PMU->enableBattVoltageMeasure();
return true;
#else
return false;
#endif

View File

@ -14,15 +14,17 @@ The RNode system is primarily software, which *transforms* different kinds of av
## Latest Release
The latest release, installable through `rnodeconf`, is version `1.72`. This release brings the following changes:
The latest release, installable through `rnodeconf`, is version `1.73`. This release brings the following changes:
- Added support for flashing T3S3 boards
- Added deep sleep support on T3S3
- Various quality updates for nRF / RAK4631
- Fixed a bug with antenna switch utilisation on RAK4631
- Updated console image to include latest packages
- Added multiple interface support - for supported boards you may now use more than one radio modem at once! Currently the only supported board is the RAK4631 with the right hardware.
- Fixes for various issues with the SX1280 - data rates are now at expected speeds overall.
- Added PA calculations for the LoRa1280F27 - this allows for the TX power to be set accurately for this modem.
- Fixes for OLED compilation errors as a result of commit 055083f.
- Added switching graphics to the display - shows statistics from up to 2 modems simultaneously.
- Fix TNC EEPROM settings not being saved - courtesy of @attermann
- Fix ESP32 linker errors - BSP version is now fixed at 2.0.17, using the older crosstool-ng linker from previous versions (2021r1)
You must have at least version `2.1.3` of `rnodeconf` installed to update the RNode Firmware to version `1.72`. Get it by updating the `rns` package to at least version `0.6.4`.
You must have at least version `2.1.3` of `rnodeconf` installed to update your RNode Firmware install to version `1.73`. Get it by updating the `rns` package to at least version `0.6.4`.
## Supported products and boards
@ -30,21 +32,28 @@ You must have at least version `2.1.3` of `rnodeconf` installed to update the RN
| Name | Manufacturer | Link | Transceiver | MCU | Description |
| :---: | :---: | :---: | :---: | :---: | :---: |
| Handheld v2.x RNodes | [Mark Qvist](https://unsigned.io) | [Buy here](https://unsigned.io/shop/product/handheld-rnode) | SX1276 | ESP32 |
| openCom XL | [Liberated Embedded Systems](https://liberatedsystems.co.uk) | [Buy here](https://store.liberatedsystems.co.uk/product/opencom-xl/) | SX1262 & SX1280 | nRF52 | Supports utilisation of both modems at once |
### Homebrew devices
| Board name | Link | Transceiver | MCU | Description |
| :--- | :---: | :---: | :---: | :---: |
| RAK4631 | [Buy here](https://store.rakwireless.com/products/rak4631-lpwan-node?m=5&h=wisblock-core) | SX1262 | nRF52 |
| LilyGO T-BEAM v1.1 | [Buy here](https://www.lilygo.cc/products/t-beam-v1-1-esp32-lora-module) | SX1276/8 or SX1262 | ESP32 |
| LilyGO T-Beam Supreme | [Buy here](https://lilygo.cc/products/t-beam-supreme) | SX1262 | ESP32-S3 |
| LilyGO LoRa32 v1.0 | [Buy here](https://www.lilygo.cc/products/lora32-v1-0) | SX1276/8 | ESP32 |
| LilyGO LoRa32 v2.0 | No link | SX1276/8 | ESP32 | Discontinued? |
| LilyGO LoRa32 v2.1 | [Buy here](https://www.lilygo.cc/products/lora3) | SX1276/8 | ESP32 | With and without TCXO |
| Heltec LoRa32 v2 | No link | SX1276/8 | ESP32 | Discontinued? |
| Heltec LoRa32 v3 | [Buy here](https://heltec.org/project/wifi-lora-32-v3/) | SX1262 | ESP32 |
| LilyGo T3S3 v1.0 | [Buy here](https://lilygo.cc/products/t3s3-v1-0) | SX1262 or SX1276 or SX1280 | ESP32-S3 |
| Heltec T114 | [Buy here](https://heltec.org/project/mesh-node-t114/) | SX1262 | nRF52 |
| Homebrew ESP32 boards | | Any supported | ESP32 | This can be any board with an Adafruit Feather (or generic) ESP32 chip |
It's easy to create your own RNodes from one of the supported development boards and devices. If a device or board you want to use is not yet supported, you are welcome to [join the effort](Documentation/CONTRIBUTING.md) and help create a board definition and pin mapping for it!
<!--| LilyGO T-Deck | [Buy here](https://lilygo.cc/products/t-deck) | SX1262 | ESP32-S3 |-->
<!--| Heltec Wireless Paper | [Buy here](https://heltec.org/project/wireless-paper/) | SX1262 | ESP32-S3 | -->
<!--<img src="Documentation/images/devboards_1.webp" width="100%"/>-->
## Supported Transceiver Modules
@ -54,7 +63,7 @@ The RNode Firmware supports all transceiver modules based on the following chips
* Semtech SX1278
* Semtech SX1280
These also must have an **SPI interface** and **DIO_0** pin connected to the MCU directly.
These also must have an **SPI interface** and **DIO_0 (sometimes called DIO_1)** pin connected to the MCU directly.
## One Tool, Many Uses
@ -105,6 +114,8 @@ pip install rns --upgrade
rnodeconf --autoinstall
```
For most of the supported device types, it is also possible to use [Liam Cottle's Web-based RNode Flasher](https://liamcottle.github.io/rnode-flasher/). This option may be easier if you're not familiar with using a command line interface.
For more detailed instruction and in-depth guides, you can have a look at some of these resources:
- Create a [basic RNode from readily available development boards](https://unsigned.io/guides/2022_01_25_installing-rnode-firmware-on-supported-devices.html)
@ -153,7 +164,7 @@ The source code includes an SX1276 driver that is released under MIT License, an
You can obtain the source code from [my business Git instance](https://git.liberatedsystems.co.uk/jacob.eva/RNode_Firmware_CE) or [GitHub](https://github.com/liberatedsystems/RNode_Firmware_CE).
Every RNode which supports the console functionality also includes an internal copy of it's own firmware source code, that can be downloaded through the [RNode Bootstrap Console](https://unsigned.io/rnode_bootstrap_console), by putting the RNode into Console Mode (which can be activated by pressing the reset button two times within two seconds).
Every RNode which supports the console functionality also includes an internal copy of it's own firmware source code, that can be downloaded through the [RNode Bootstrap Console](https://unsigned.io/rnode_bootstrap_console), by putting the RNode into Console Mode (which can be activated by holding the user button for 10 seconds and releasing it).
The RNode Ecosystem is free and non-proprietary, and actively seeks to distribute it's ownership and control. If you want to build RNodes for commercial purposes, including selling them, you must do so adhering to the Open Source licenses that the various parts of the RNode project is released under, and under your own responsibility.

File diff suppressed because it is too large Load Diff

98
ROM.h
View File

@ -1,4 +1,4 @@
// Copyright (C) 2023, Mark Qvist
// Copyright (C) 2024, Mark Qvist
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -14,71 +14,45 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#ifndef ROM_H
#define ROM_H
#define ROM_H
#define CHECKSUMMED_SIZE 0x0B
#define CHECKSUMMED_SIZE 0x0B
// ROM address map ///////////////
#define ADDR_PRODUCT 0x00
#define ADDR_MODEL 0x01
#define ADDR_HW_REV 0x02
#define ADDR_SERIAL 0x03
#define ADDR_MADE 0x07
#define ADDR_CHKSUM 0x0B
#define ADDR_SIGNATURE 0x1B
#define ADDR_INFO_LOCK 0x9B
#define PRODUCT_RNODE 0x03
#define PRODUCT_HMBRW 0xF0
#define PRODUCT_TBEAM 0xE0
#define PRODUCT_T32_10 0xB2
#define PRODUCT_T32_20 0xB0
#define PRODUCT_T32_21 0xB1
#define PRODUCT_H32_V2 0xC0
#define PRODUCT_H32_V3 0xC1
#define PRODUCT_RAK4631 0x10
#define MODEL_11 0x11
#define MODEL_12 0x12
#define MODEL_A1 0xA1
#define MODEL_A6 0xA6
#define MODEL_A4 0xA4
#define MODEL_A9 0xA9
#define MODEL_A3 0xA3
#define MODEL_A8 0xA8
#define MODEL_A2 0xA2
#define MODEL_A7 0xA7
#define MODEL_B3 0xB3
#define MODEL_B8 0xB8
#define MODEL_B4 0xB4
#define MODEL_B9 0xB9
#define MODEL_BA 0xBA
#define MODEL_BB 0xBB
#define MODEL_C4 0xC4
#define MODEL_C9 0xC9
#define MODEL_C5 0xC5
#define MODEL_CA 0xCA
#define MODEL_E4 0xE4
#define MODEL_E9 0xE9
#define MODEL_E3 0xE3
#define MODEL_E8 0xE8
#define MODEL_FE 0xFE
#define MODEL_FF 0xFF
#define ADDR_CONF_SF 0x9C
#define ADDR_CONF_CR 0x9D
#define ADDR_CONF_TXP 0x9E
#define ADDR_CONF_BW 0x9F
#define ADDR_CONF_FREQ 0xA3
#define ADDR_CONF_OK 0xA7
#define ADDR_PRODUCT 0x00
#define ADDR_MODEL 0x01
#define ADDR_HW_REV 0x02
#define ADDR_SERIAL 0x03
#define ADDR_MADE 0x07
#define ADDR_CHKSUM 0x0B
#define ADDR_SIGNATURE 0x1B
#define ADDR_INFO_LOCK 0x9B
#define ADDR_CONF_BT 0xB0
#define ADDR_CONF_DSET 0xB1
#define ADDR_CONF_DINT 0xB2
#define ADDR_CONF_DADR 0xB3
#define ADDR_CONF_DBLK 0xB4
#define ADDR_CONF_PSET 0xB5
#define ADDR_CONF_PINT 0xB6
#define ADDR_CONF_BSET 0xB7
#define ADDR_CONF_DROT 0xB8
#define ADDR_CONF_PSET 0xB5
#define ADDR_CONF_PINT 0xB6
#define ADDR_CONF_BSET 0xB7
#define ADDR_CONF_DIA 0xB9
#define ADDR_CONF_SF 0x9C
#define ADDR_CONF_CR 0x9D
#define ADDR_CONF_TXP 0x9E
#define ADDR_CONF_BW 0x9F
#define ADDR_CONF_FREQ 0xA3
#define ADDR_CONF_OK 0xA7
#define ADDR_CONF_BT 0xB0
#define ADDR_CONF_DSET 0xB1
#define ADDR_CONF_DINT 0xB2
#define ADDR_CONF_DADR 0xB3
#define INFO_LOCK_BYTE 0x73
#define CONF_OK_BYTE 0x73
#define BT_ENABLE_BYTE 0x73
#define INFO_LOCK_BYTE 0x73
#define CONF_OK_BYTE 0x73
#define BT_ENABLE_BYTE 0x73
#define EEPROM_RESERVED 200
#define EEPROM_RESERVED 200
//////////////////////////////////
#endif

1067
Radio.cpp

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// Copyright (c) Sandeep Mistry. All rights reserved.
// Licensed under the MIT license.
// Modifications and additions copyright 2023 by Mark Qvist & Jacob Eva
// Modifications and additions copyright 2024 by Mark Qvist & Jacob Eva
// Obviously still under the MIT license.
#ifndef RADIO_H
@ -11,6 +11,7 @@
#include <SPI.h>
#include "Interfaces.h"
#include "Boards.h"
#include "src/misc/FIFOBuffer.h"
#define MAX_PKT_LENGTH 255
@ -18,6 +19,15 @@
#define PA_OUTPUT_RFO_PIN 0
#define PA_OUTPUT_PA_BOOST_PIN 1
// Default LoRa settings
#define PHY_HEADER_LORA_SYMBOLS 20
#define PHY_CRC_LORA_BITS 16
#define LORA_PREAMBLE_SYMBOLS_MIN 18
#define LORA_PREAMBLE_TARGET_MS 24
#define LORA_PREAMBLE_FAST_DELTA 18
#define LORA_FAST_THRESHOLD_BPS 30E3
#define LORA_LIMIT_THRESHOLD_BPS 60E3
// DCD
#define STATUS_INTERVAL_MS 3
#define DCD_SAMPLES 2500
@ -28,20 +38,31 @@
#define AIRTIME_BINLEN_MS (STATUS_INTERVAL_MS*DCD_SAMPLES)
#define AIRTIME_BINS ((AIRTIME_LONGTERM*1000)/AIRTIME_BINLEN_MS)
#define current_airtime_bin(void) (millis()%AIRTIME_LONGTERM_MS)/AIRTIME_BINLEN_MS
#define DCD_THRESHOLD 2
#define DCD_LED_STEP_D 3
#define LORA_PREAMBLE_SYMBOLS_HW 4
#define LORA_PREAMBLE_SYMBOLS_MIN 18
#define LORA_PREAMBLE_TARGET_MS 15
#define LORA_PREAMBLE_FAST_TARGET_MS 1
#define LORA_FAST_BITRATE_THRESHOLD 40000
// CSMA Parameters
#define CSMA_SIFS_MS 0
#define CSMA_POST_TX_YIELD_SLOTS 3
#define CSMA_SLOT_MAX_MS 100
#define CSMA_SLOT_MIN_MS 24
#define CSMA_SLOT_MIN_FAST_DELTA 18
#define CSMA_SLOT_SYMBOLS 12
#define CSMA_CW_BANDS 4
#define CSMA_CW_MIN 0
#define CSMA_CW_PER_BAND_WINDOWS 15
#define CSMA_BAND_1_MAX_AIRTIME 7
#define CSMA_BAND_N_MIN_AIRTIME 85
#define CSMA_INFR_THRESHOLD_DB 12
#define LED_ID_TRIG 16
#define NOISE_FLOOR_SAMPLES 64
#define RSSI_OFFSET 157
#define PHY_HEADER_LORA_SYMBOLS 8
#define _e 2.71828183
#define _S 10.0
#define MODEM_TIMEOUT_MULT 1.5
// Status flags
const uint8_t SIG_DETECT = 0x01;
@ -50,10 +71,14 @@ const uint8_t RX_ONGOING = 0x04;
// forward declare Utilities.h LED functions
void led_rx_on();
void led_rx_off();
void led_id_on();
void led_id_off();
void led_indicate_airtime_lock();
void kiss_indicate_channel_stats(uint8_t index);
void kiss_indicate_csma_stats(uint8_t index);
#if PLATFORM == PLATFORM_ESP32
// get update_lock for ESP32
extern portMUX_TYPE update_lock;
@ -62,25 +87,28 @@ extern portMUX_TYPE update_lock;
class RadioInterface : public Stream {
public:
// todo: in the future define _spiModem and _spiSettings from here for inheritence by child classes
RadioInterface(uint8_t index) : _index(index), _radio_locked(false),
RadioInterface(uint8_t index) : _index(index), _sf(0x07), _radio_locked(false),
_radio_online(false), _st_airtime_limit(0.0), _lt_airtime_limit(0.0),
_airtime_lock(false), _airtime(0.0), _longterm_airtime(0.0),
_airtime_lock(false), _airtime(0.0), _longterm_airtime(0.0), _last_packet_cost(0.0),
_local_channel_util(0.0), _total_channel_util(0.0),
_longterm_channel_util(0.0), _last_status_update(0),
_stat_signal_detected(false), _stat_signal_synced(false),_stat_rx_ongoing(false), _last_dcd(0),
_dcd_count(0), _dcd(false), _dcd_led(false),
_dcd_waiting(false), _dcd_wait_until(0), _dcd_sample(0),
_post_tx_yield_timeout(0), _csma_slot_ms(50), _csma_p_min(0.1),
_csma_p_max(0.8), _preambleLength(6), _lora_symbol_time_ms(0.0),
_lora_symbol_rate(0.0), _lora_us_per_byte(0.0), _bitrate(0),
_packet{0}, _onReceive(NULL) {};
_dcd_waiting(false), _dcd_sample(0),
_csma_slot_ms(CSMA_SLOT_MIN_MS),
_preambleLength(LORA_PREAMBLE_SYMBOLS_MIN), _lora_symbol_time_ms(0.0),
_lora_preamble_time_ms(0), _lora_header_time_ms(0), _lora_symbol_rate(0.0), _lora_us_per_byte(0.0), _bitrate(0),
_packet{0}, _onReceive(NULL), _txp(0), _ldro(false), _limit_rate(false), _interference_detected(false), _avoid_interference(true), _difs_ms(CSMA_SIFS_MS + 2 * _csma_slot_ms), _difs_wait_start(0), _cw_wait_start(0), _cw_wait_target(0), _cw_wait_passed(0), _csma_cw(-1), _cw_band(1), _cw_min(0), _cw_max(CSMA_CW_PER_BAND_WINDOWS), _noise_floor_sampled(false), _noise_floor_sample(0), _noise_floor_buffer({0}), _noise_floor(-292), _led_id_filter(0), _preamble_detected_at(0) {};
virtual void reset() = 0;
virtual int begin() = 0;
virtual void end() = 0;
virtual int beginPacket(int implicitHeader = false) = 0;
virtual int endPacket() = 0;
virtual int packetRssi() = 0;
virtual int packetRssi(uint8_t pkt_snr_raw = 0xFF) = 0;
virtual int currentRssi() = 0;
virtual uint8_t packetRssiRaw() = 0;
virtual uint8_t currentRssiRaw() = 0;
@ -105,7 +133,7 @@ public:
virtual void sleep() = 0;
virtual bool preInit() = 0;
virtual uint8_t getTxPower() = 0;
virtual int8_t getTxPower() = 0;
virtual void setTxPower(int level, int outputPin = PA_OUTPUT_PA_BOOST_PIN) = 0;
virtual uint32_t getFrequency() = 0;
virtual void setFrequency(uint32_t frequency) = 0;
@ -116,19 +144,49 @@ public:
virtual void setCodingRate4(int denominator) = 0;
virtual uint8_t getCodingRate4() = 0;
virtual void setPreambleLength(long length) = 0;
virtual uint8_t modemStatus() = 0;
virtual bool dcd() = 0;
virtual void enableCrc() = 0;
virtual void disableCrc() = 0;
virtual void enableTCXO() = 0;
virtual void disableTCXO() = 0;
virtual byte random() = 0;
virtual uint8_t random() = 0;
virtual void setSPIFrequency(uint32_t frequency) = 0;
virtual void updateBitrate() = 0;
void updateBitrate() {
if (!_radio_online) { _bitrate = 0; }
else {
_lora_symbol_rate = (float)getSignalBandwidth()/(float)(pow(2, _sf));
_lora_symbol_time_ms = (1.0/_lora_symbol_rate)*1000.0;
_bitrate = (uint32_t)(_sf * ( (4.0/(float)getCodingRate4()) / ((float)(pow(2, _sf))/((float)getSignalBandwidth()/1000.0)) ) * 1000.0);
_lora_us_per_byte = 1000000.0/((float)_bitrate/8.0);
bool fast_rate = _bitrate > LORA_FAST_THRESHOLD_BPS;
_limit_rate = _bitrate > LORA_LIMIT_THRESHOLD_BPS;
int csma_slot_min_ms = CSMA_SLOT_MIN_MS;
float lora_preamble_target_ms = LORA_PREAMBLE_TARGET_MS;
if (fast_rate) { csma_slot_min_ms -= CSMA_SLOT_MIN_FAST_DELTA;
lora_preamble_target_ms -= LORA_PREAMBLE_FAST_DELTA; }
_csma_slot_ms = _lora_symbol_time_ms*CSMA_SLOT_SYMBOLS;
if (_csma_slot_ms > CSMA_SLOT_MAX_MS) { _csma_slot_ms = CSMA_SLOT_MAX_MS; }
if (_csma_slot_ms < CSMA_SLOT_MIN_MS) { _csma_slot_ms = csma_slot_min_ms; }
_difs_ms = CSMA_SIFS_MS + 2*_csma_slot_ms;
float target_preamble_symbols = lora_preamble_target_ms/_lora_symbol_time_ms;
if (target_preamble_symbols < LORA_PREAMBLE_SYMBOLS_MIN) { target_preamble_symbols = LORA_PREAMBLE_SYMBOLS_MIN; }
else { target_preamble_symbols = (ceil)(target_preamble_symbols); }
setPreambleLength(target_preamble_symbols);
_lora_preamble_time_ms = (ceil)(_preambleLength * _lora_symbol_time_ms);
_lora_header_time_ms = (ceil)(PHY_HEADER_LORA_SYMBOLS * _lora_symbol_time_ms);
}
}
virtual void handleDio0Rise() = 0;
virtual void clearIRQStatus() = 0;
virtual bool getPacketValidity() = 0;
uint32_t getBitrate() { return _bitrate; };
uint8_t getIndex() { return _index; };
void setRadioLock(bool lock) { _radio_locked = lock; };
@ -168,131 +226,182 @@ public:
}
_longterm_channel_util = (float)longterm_channel_util_sum/(float)AIRTIME_BINS;
updateCSMAp();
//kiss_indicate_channel_stats(); // todo: enable me!
updateCSMAParameters();
kiss_indicate_channel_stats(_index);
};
void addAirtime(uint16_t written) {
float getAirtime(uint16_t written) {
float lora_symbols = 0;
float packet_cost_ms = 0.0;
float payload_cost_ms = ((float)written * _lora_us_per_byte)/1000.0;
packet_cost_ms += payload_cost_ms;
packet_cost_ms += (_preambleLength+4.25)*_lora_symbol_time_ms;
packet_cost_ms += PHY_HEADER_LORA_SYMBOLS * _lora_symbol_time_ms;
if (interfaces[_index] == SX1276 || interfaces[_index] == SX1278) {
lora_symbols += (8*written + PHY_CRC_LORA_BITS - 4*_sf + 8 + PHY_HEADER_LORA_SYMBOLS);
lora_symbols /= 4*(_sf-2*_ldro);
lora_symbols *= getCodingRate4();
lora_symbols += _preambleLength + 0.25 + 8;
packet_cost_ms += lora_symbols * _lora_symbol_time_ms;
}
else if (interfaces[_index] == SX1262 || interfaces[_index] == SX1280) {
if (_sf < 7) {
lora_symbols += (8*written + PHY_CRC_LORA_BITS - 4*_sf + PHY_HEADER_LORA_SYMBOLS);
lora_symbols /= 4*_sf;
lora_symbols *= getCodingRate4();
lora_symbols += _preambleLength + 2.25 + 8;
packet_cost_ms += lora_symbols * _lora_symbol_time_ms;
} else {
lora_symbols += (8*written + PHY_CRC_LORA_BITS - 4*_sf + 8 + PHY_HEADER_LORA_SYMBOLS);
lora_symbols /= 4*(_sf-2*_ldro);
lora_symbols *= getCodingRate4();
lora_symbols += _preambleLength + 0.25 + 8;
packet_cost_ms += lora_symbols * _lora_symbol_time_ms;
}
}
_last_packet_cost = packet_cost_ms;
return packet_cost_ms;
}
void addAirtime() {
uint16_t cb = current_airtime_bin();
uint16_t nb = cb+1; if (nb == AIRTIME_BINS) { nb = 0; }
_airtime_bins[cb] += packet_cost_ms;
_airtime_bins[cb] += _last_packet_cost;
_airtime_bins[nb] = 0;
};
void updateModemStatus() {
#if MCU_VARIANT == MCU_ESP32
portENTER_CRITICAL(&update_lock);
#elif MCU_VARIANT == MCU_NRF52
portENTER_CRITICAL();
#endif
bool carrier_detected = dcd();
int current_rssi = currentRssi();
_last_status_update = millis();
#if MCU_VARIANT == MCU_ESP32
portEXIT_CRITICAL(&update_lock);
#elif MCU_VARIANT == MCU_NRF52
portEXIT_CRITICAL();
#endif
_interference_detected = !carrier_detected && (current_rssi > (_noise_floor+CSMA_INFR_THRESHOLD_DB));
if (_interference_detected) { if (_led_id_filter < LED_ID_TRIG) { _led_id_filter += 1; } }
else { if (_led_id_filter > 0) {_led_id_filter -= 1; } }
if (carrier_detected) { _dcd = true; } else { _dcd = false; }
_dcd_led = _dcd;
if (_dcd_led) { led_rx_on(); }
else {
if (_interference_detected) {
if (_led_id_filter >= LED_ID_TRIG && _noise_floor_sampled) { led_id_on(); }
} else {
if (_airtime_lock) { led_indicate_airtime_lock(); }
else { led_rx_off(); led_id_off(); }
}
}
}
void updateNoiseFloor() {
int current_rssi = currentRssi();
if (!_dcd) {
if (!_noise_floor_sampled || current_rssi < _noise_floor + CSMA_INFR_THRESHOLD_DB) {
_noise_floor_buffer[_noise_floor_sample] = current_rssi;
_noise_floor_sample = _noise_floor_sample+1;
if (_noise_floor_sample >= NOISE_FLOOR_SAMPLES) {
_noise_floor_sample %= NOISE_FLOOR_SAMPLES;
_noise_floor_sampled = true;
}
if (_noise_floor_sampled) {
_noise_floor = 0;
for (int ni = 0; ni < NOISE_FLOOR_SAMPLES; ni++) { _noise_floor += _noise_floor_buffer[ni]; }
_noise_floor /= NOISE_FLOOR_SAMPLES;
}
}
}
}
void checkModemStatus() {
if (millis()-_last_status_update >= STATUS_INTERVAL_MS) {
updateModemStatus();
_util_samples[_dcd_sample] = _dcd;
_dcd_sample = (_dcd_sample+1)%DCD_SAMPLES;
if (_dcd_sample % UTIL_UPDATE_INTERVAL == 0) {
updateNoiseFloor();
_util_samples[_dcd_sample] = _dcd;
_dcd_sample = (_dcd_sample+1)%DCD_SAMPLES;
if (_dcd_sample % UTIL_UPDATE_INTERVAL == 0) {
int util_count = 0;
for (int ui = 0; ui < DCD_SAMPLES; ui++) {
if (_util_samples[ui]) util_count++;
if (_util_samples[ui]) util_count++;
}
_local_channel_util = (float)util_count / (float)DCD_SAMPLES;
_total_channel_util = _local_channel_util + _airtime;
if (_total_channel_util > 1.0) _total_channel_util = 1.0;
int16_t cb = current_airtime_bin();
uint16_t nb = cb+1; if (nb == AIRTIME_BINS) { nb = 0; }
if (_total_channel_util > _longterm_bins[cb]) _longterm_bins[cb] = _total_channel_util;
_longterm_bins[nb] = 0.0;
updateAirtime();
}
}
}
};
void updateModemStatus() {
#if PLATFORM == PLATFORM_ESP32
portENTER_CRITICAL(&update_lock);
#elif PLATFORM == PLATFORM_NRF52
portENTER_CRITICAL();
#endif
uint8_t status = modemStatus();
_last_status_update = millis();
#if PLATFORM == PLATFORM_ESP32
portEXIT_CRITICAL(&update_lock);
#elif PLATFORM == PLATFORM_NRF52
portEXIT_CRITICAL();
#endif
if ((status & SIG_DETECT) == SIG_DETECT) { _stat_signal_detected = true; } else { _stat_signal_detected = false; }
if ((status & SIG_SYNCED) == SIG_SYNCED) { _stat_signal_synced = true; } else { _stat_signal_synced = false; }
if ((status & RX_ONGOING) == RX_ONGOING) { _stat_rx_ongoing = true; } else { _stat_rx_ongoing = false; }
// if (stat_signal_detected || stat_signal_synced || stat_rx_ongoing) {
if (_stat_signal_detected || _stat_signal_synced) {
if (_stat_rx_ongoing) {
if (_dcd_count < DCD_THRESHOLD) {
_dcd_count++;
} else {
_last_dcd = _last_status_update;
_dcd_led = true;
_dcd = true;
}
}
} else {
if (_dcd_count == 0) {
_dcd_led = false;
} else if (_dcd_count > DCD_LED_STEP_D) {
_dcd_count -= DCD_LED_STEP_D;
} else {
_dcd_count = 0;
}
if (_last_status_update > _last_dcd+_csma_slot_ms) {
_dcd = false;
_dcd_led = false;
_dcd_count = 0;
}
}
void updateCSMAParameters() {
int airtime_pct = (int)(_airtime*100);
int new_cw_band = _cw_band;
if (_dcd_led) {
led_rx_on();
} else {
if (_airtime_lock) {
led_indicate_airtime_lock();
} else {
led_rx_off();
}
}
};
void setPostTxYieldTimeout(uint32_t timeout) { _post_tx_yield_timeout = timeout; };
uint32_t getPostTxYieldTimeout() { return _post_tx_yield_timeout; };
if (airtime_pct <= CSMA_BAND_1_MAX_AIRTIME) { new_cw_band = 1; }
else {
int at = airtime_pct + CSMA_BAND_1_MAX_AIRTIME;
new_cw_band = map(at, CSMA_BAND_1_MAX_AIRTIME, CSMA_BAND_N_MIN_AIRTIME, 2, CSMA_CW_BANDS);
}
if (new_cw_band > CSMA_CW_BANDS) { new_cw_band = CSMA_CW_BANDS; }
if (new_cw_band != _cw_band) {
_cw_band = (uint8_t)(new_cw_band);
_cw_min = (_cw_band-1) * CSMA_CW_PER_BAND_WINDOWS;
_cw_max = (_cw_band) * CSMA_CW_PER_BAND_WINDOWS - 1;
kiss_indicate_csma_stats(_index);
}
}
void setDCD(bool dcd) { _dcd = dcd; };
bool getDCD() { return _dcd; };
void setDCDWaiting(bool dcd_waiting) { _dcd_waiting = dcd_waiting; };
bool getDCDWaiting() { return _dcd_waiting; };
void setDCDWaitUntil(uint32_t dcd_wait_until) { _dcd_wait_until = dcd_wait_until; };
bool getDCDWaitUntil() { return _dcd_wait_until; };
float getAirtime() { return _airtime; };
float getLongtermAirtime() { return _longterm_airtime; };
float getTotalChannelUtil() { return _total_channel_util; };
float getLongtermChannelUtil() { return _longterm_channel_util; };
float CSMASlope(float u) { return (pow(_e,_S*u-_S/2.0))/(pow(_e,_S*u-_S/2.0)+1.0); };
void updateCSMAp() {
_csma_p = (uint8_t)((1.0-(_csma_p_min+(_csma_p_max-_csma_p_min)*CSMASlope(_airtime)))*255.0);
};
uint8_t getCSMAp() { return _csma_p; };
void setCSMASlotMS(int slot_size) { _csma_slot_ms = slot_size; };
int getCSMASlotMS() { return _csma_slot_ms; };
float getSymbolTime() { return _lora_symbol_time_ms; };
float getSymbolRate() { return _lora_symbol_rate; };
long getPreambleLength() { return _preambleLength; };
void setAvdInterference(bool cfg) { _avoid_interference = cfg; };
bool getAvdInterference() { return _avoid_interference; };
bool getInterference() { return _interference_detected; };
int getNoiseFloor() { return _noise_floor; };
unsigned long getDifsMS() { return _difs_ms; };
uint8_t getCWBand() { return _cw_band; };
uint8_t getCWMin() { return _cw_min; };
uint8_t getCWMax() { return _cw_max; };
uint8_t getCW() { return _csma_cw; };
void setCW(uint8_t cw) { _csma_cw = cw; };
void setCWWaitTarget(unsigned long target) { _cw_wait_target = target; };
unsigned long getCWWaitTarget() { return _cw_wait_target; };
unsigned long getDifsWaitStart() { return _difs_wait_start; };
void setDifsWaitStart(unsigned long start) { _difs_wait_start = start; };
unsigned long getCWWaitStart() { return _cw_wait_start; };
void setCWWaitStart(unsigned long start) { _cw_wait_start = start; };
void addCWWaitPassed(unsigned long start) { _cw_wait_passed += start; };
void resetCWWaitPassed() { _cw_wait_passed = 0; };
bool getCWWaitStatus() { return _cw_wait_passed < _cw_wait_target; };
bool getLimitRate() { return _limit_rate; };
protected:
virtual void explicitHeaderMode() = 0;
virtual void implicitHeaderMode() = 0;
uint8_t _index;
uint32_t _bitrate;
int8_t _txp;
uint8_t _sf;
bool _radio_locked;
bool _radio_online;
float _st_airtime_limit;
@ -302,6 +411,7 @@ protected:
uint16_t _longterm_bins[AIRTIME_BINS] = {0};
float _airtime;
float _longterm_airtime;
float _last_packet_cost;
float _local_channel_util;
float _total_channel_util;
float _longterm_channel_util;
@ -314,35 +424,53 @@ protected:
bool _dcd;
bool _dcd_led;
bool _dcd_waiting;
long _dcd_wait_until;
bool _util_samples[DCD_SAMPLES] = {false};
int _dcd_sample;
uint32_t _post_tx_yield_timeout;
uint8_t _csma_p;
int _csma_slot_ms;
float _csma_p_min;
float _csma_p_max;
long _preambleLength;
float _lora_symbol_time_ms;
float _lora_symbol_rate;
float _lora_us_per_byte;
uint32_t _bitrate;
uint8_t _packet[255];
long _lora_preamble_time_ms;
long _lora_header_time_ms;
bool _ldro;
bool _limit_rate;
bool _interference_detected;
bool _avoid_interference;
int _csma_slot_ms;
unsigned long _difs_ms;
unsigned long _difs_wait_start;
unsigned long _cw_wait_start;
unsigned long _cw_wait_target;
unsigned long _cw_wait_passed;
int _csma_cw;
uint8_t _cw_band;
uint8_t _cw_min;
uint8_t _cw_max;
bool _noise_floor_sampled;
int _noise_floor_sample;
int _noise_floor_buffer[NOISE_FLOOR_SAMPLES];
int _noise_floor;
uint8_t _led_id_filter;
unsigned long _preamble_detected_at;
uint8_t _packet[255];
void (*_onReceive)(uint8_t, int);
};
class sx126x : public RadioInterface {
public:
sx126x(uint8_t index, SPIClass spi, bool tcxo, bool dio2_as_rf_switch, int ss, int sclk, int mosi, int miso, int reset, int
sx126x(uint8_t index, SPIClass* spi, bool tcxo, bool dio2_as_rf_switch, int ss, int sclk, int mosi, int miso, int reset, int
dio0, int busy, int rxen);
void reset();
int begin();
void end();
int beginPacket(int implicitHeader = false);
int endPacket();
int packetRssi();
int packetRssi(uint8_t pkt_snr_raw = 0xFF);
int currentRssi();
uint8_t packetRssiRaw();
uint8_t currentRssiRaw();
@ -367,7 +495,7 @@ public:
void sleep();
bool preInit();
uint8_t getTxPower();
int8_t getTxPower();
void setTxPower(int level, int outputPin = PA_OUTPUT_PA_BOOST_PIN);
uint32_t getFrequency();
void setFrequency(uint32_t frequency);
@ -378,7 +506,7 @@ public:
void setCodingRate4(int denominator);
uint8_t getCodingRate4();
void setPreambleLength(long length);
uint8_t modemStatus();
bool dcd();
void enableCrc();
void disableCrc();
void enableTCXO();
@ -391,8 +519,6 @@ public:
void dumpRegisters(Stream& out);
void updateBitrate();
void handleDio0Rise();
private:
void writeBuffer(const uint8_t* buffer, size_t size);
@ -418,14 +544,13 @@ private:
void handleLowDataRate();
void optimizeModemSensitivity();
void reset(void);
void calibrate(void);
void calibrate_image(uint32_t frequency);
void clearIRQStatus();
bool getPacketValidity();
private:
SPISettings _spiSettings;
SPIClass _spiModem;
SPIClass* _spiModem;
int _ss;
int _sclk;
int _mosi;
@ -435,11 +560,8 @@ private:
int _rxen;
int _busy;
uint32_t _frequency;
int _txp;
uint8_t _sf;
uint8_t _bw;
uint8_t _cr;
uint8_t _ldro;
int _packetIndex;
int _implicitHeaderMode;
int _payloadLength;
@ -447,14 +569,15 @@ private:
int _fifo_tx_addr_ptr;
int _fifo_rx_addr_ptr;
bool _preinit_done;
uint8_t _index;
bool _tcxo;
bool _dio2_as_rf_switch;
};
class sx127x : public RadioInterface {
public:
sx127x(uint8_t index, SPIClass spi, int ss, int sclk, int mosi, int miso, int reset, int dio0, int busy);
sx127x(uint8_t index, SPIClass* spi, int ss, int sclk, int mosi, int miso, int reset, int dio0, int busy);
void reset();
int begin();
void end();
@ -462,6 +585,7 @@ public:
int beginPacket(int implicitHeader = false);
int endPacket();
int packetRssi(uint8_t pkt_snr_raw = 0xFF);
int packetRssi();
int currentRssi();
uint8_t packetRssiRaw();
@ -487,7 +611,7 @@ public:
void sleep();
bool preInit();
uint8_t getTxPower();
int8_t getTxPower();
void setTxPower(int level, int outputPin = PA_OUTPUT_PA_BOOST_PIN);
uint32_t getFrequency();
void setFrequency(uint32_t frequency);
@ -498,7 +622,7 @@ public:
void setCodingRate4(int denominator);
uint8_t getCodingRate4();
void setPreambleLength(long length);
uint8_t modemStatus();
bool dcd();
void enableCrc();
void disableCrc();
void enableTCXO();
@ -508,10 +632,8 @@ public:
void setSPIFrequency(uint32_t frequency);
void updateBitrate();
void handleDio0Rise();
void clearIRQStatus();
bool getPacketValidity();
private:
void setSyncWord(uint8_t sw);
void explicitHeaderMode();
@ -529,7 +651,7 @@ private:
private:
SPISettings _spiSettings;
SPIClass _spiModem;
SPIClass* _spiModem;
int _ss;
int _sclk;
int _mosi;
@ -541,14 +663,15 @@ private:
int _packetIndex;
int _implicitHeaderMode;
bool _preinit_done;
uint8_t _index;
uint8_t _sf;
uint8_t _cr;
uint32_t _bw;
};
class sx128x : public RadioInterface {
public:
sx128x(uint8_t index, SPIClass spi, bool tcxo, int ss, int sclk, int mosi, int miso, int reset, int dio0, int busy, int rxen, int txen);
sx128x(uint8_t index, SPIClass* spi, bool tcxo, int ss, int sclk, int mosi, int miso, int reset, int dio0, int busy, int rxen, int txen);
void reset();
int begin();
void end();
@ -556,7 +679,7 @@ public:
int beginPacket(int implicitHeader = false);
int endPacket();
int packetRssi();
int packetRssi(uint8_t pkt_snr_raw = 0xFF);
int currentRssi();
uint8_t packetRssiRaw();
uint8_t currentRssiRaw();
@ -581,7 +704,7 @@ public:
void sleep();
bool preInit();
uint8_t getTxPower();
int8_t getTxPower();
void setTxPower(int level, int outputPin = PA_OUTPUT_PA_BOOST_PIN);
uint32_t getFrequency();
void setFrequency(uint32_t frequency);
@ -592,7 +715,7 @@ public:
void setCodingRate4(int denominator);
uint8_t getCodingRate4();
void setPreambleLength(long length);
uint8_t modemStatus();
bool dcd();
void enableCrc();
void disableCrc();
void enableTCXO();
@ -604,11 +727,10 @@ public:
void dumpRegisters(Stream& out);
void updateBitrate();
void handleDio0Rise();
void clearIRQStatus();
bool getPacketValidity();
private:
void writeBuffer(const uint8_t* buffer, size_t size);
void readBuffer(uint8_t* buffer, size_t size);
@ -636,7 +758,7 @@ private:
private:
SPISettings _spiSettings;
SPIClass _spiModem;
SPIClass* _spiModem;
int _ss;
int _sclk;
int _mosi;
@ -648,8 +770,6 @@ private:
int _busy;
int _modem;
uint32_t _frequency;
int _txp;
uint8_t _sf;
uint8_t _bw;
uint8_t _cr;
int _packetIndex;
@ -660,7 +780,9 @@ private:
int _fifo_rx_addr_ptr;
bool _preinit_done;
int _rxPacketLength;
uint8_t _index;
bool _tcxo;
uint8_t _preamble_e;
uint8_t _preamble_m;
uint32_t _last_preamble;
};
#endif

View File

@ -1,5 +1,5 @@
# Precompiled Firmware
You can download and flash the firmware to supported boards using the [RNode Config Utility](https://github.com/markqvist/rnodeconfigutil). All firmware releases are now handled and installed directly through `rnodeconf`, which is inclueded in the `rns` package. It can be installed via `pip`:
The firmware is now handled and installed to RNodes directly through `rnodeconf`, which is inclueded in the `rns` package. It can be installed via `pip`:
```
# Install rnodeconf via rns package

Binary file not shown.

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# SPDX-FileCopyrightText: 2014-2022 Fredrik Ahlberg, Angus Gratton, Espressif Systems (Shanghai) CO LTD, other contributors as noted.
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# ESP32 partition table generation tool
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# spiffsgen is a tool used to generate a spiffs image from a directory
#

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
board_manager:
additional_urls:
- https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
- https://liberatedsystems.co.uk/rnode-firmware-ce/esp-custom-package.json
- https://raw.githubusercontent.com/RAKwireless/RAKwireless-Arduino-BSP-Index/main/package_rakwireless_index.json
- http://unsigned.io/arduino/package_unsignedio_UnsignedBoards_index.json
- https://github.com/HelTecAutomation/Heltec_nRF52/releases/download/1.7.0/package_heltec_nrf_index.json

47
esp32_btbufs.py Executable file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env python3
import sys
try:
target_path = sys.argv[1]
rxbuf_size = 0; rxbuf_minsize = 6144
txbuf_size = 0; txbuf_minsize = 384
line_index = 0
rx_line_index = 0
tx_line_index = 0
with open(target_path) as sf:
for line in sf:
line_index += 1
if line.startswith("#define RX_QUEUE_SIZE"):
ents = line.split(" ")
try:
rxbuf_size = int(ents[2])
rx_line_index = line_index
except Exception as e:
print(f"Could not parse Bluetooth RX_QUEUE_SIZE: {e}")
if line.startswith("#define TX_QUEUE_SIZE"):
ents = line.split(" ")
try:
txbuf_size = int(ents[2])
tx_line_index = line_index
except Exception as e:
print(f"Could not parse Bluetooth RX_QUEUE_SIZE: {e}")
if rxbuf_size != 0 and txbuf_size != 0:
break
if rxbuf_size < rxbuf_minsize:
print(f"Error: The configured ESP32 Bluetooth RX buffer size is too small, please set it to at least {rxbuf_minsize} and try compiling again.")
print(f"The buffer configuration can be modified in line {rx_line_index} of: {target_path}")
exit(1)
if txbuf_size < txbuf_minsize:
print(f"Error: The configured ESP32 Bluetooth TX buffer size is too small, please set it to at least {txbuf_minsize} and try compiling again.")
print(f"The buffer configuration can be modified in line {tx_line_index} of: {target_path}")
exit(1)
exit(0)
except Exception as e:
print(f"Could not determine ESP32 Bluetooth buffer configuration: {e}")
print("Please fix this error and try again")

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Copyright (C) 2023, Mark Qvist
# Copyright (C) 2024, Mark Qvist
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -20,6 +20,7 @@ import sys
import RNS
import json
import hashlib
import subprocess
major_version = None
minor_version = None
@ -27,9 +28,23 @@ target_version = None
target_file = os.path.join(sys.argv[1])
firmware_data = open(target_file, "rb").read()
calc_hash = hashlib.sha256(firmware_data[0:-32]).digest()
part_hash = firmware_data[-32:]
if sys.argv[1] == "from_device":
from_device = True
else:
from_device = False
if calc_hash == part_hash:
print(RNS.hexrep(part_hash, delimit=False))
if not from_device:
firmware_data = open(target_file, "rb").read()
calc_hash = hashlib.sha256(firmware_data[0:-32]).digest()
part_hash = firmware_data[-32:]
if calc_hash == part_hash:
print(RNS.hexrep(part_hash, delimit=False))
else:
try:
cmdresult = subprocess.run(["rnodeconf", sys.argv[2], "-L"], stdout=subprocess.PIPE).stdout.decode('utf-8')
part_hash = cmdresult.split("The actual firmware hash is: ")[1].replace("\n", "")
print(part_hash)
except Exception as e:
print("Could not get partition hash from device: "+str(e))

View File

@ -1,6 +1,6 @@
#!/bin/python
#!/bin/python3
# Copyright (C) 2023, Mark Qvist
# Copyright (C) 2024, Mark Qvist
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -47,4 +47,4 @@ for filename in files:
"version": target_version
}
print(json.dumps(release_hashes))
print(json.dumps(release_hashes))

153
src/ble/BLESerial.cpp Normal file
View File

@ -0,0 +1,153 @@
// Copyright (C) 2024, Mark Qvist
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <Arduino.h>
#include "../../Boards.h"
#if PLATFORM != PLATFORM_NRF52
#if HAS_BLE
#include "BLESerial.h"
uint32_t bt_passkey_callback();
void bt_passkey_notify_callback(uint32_t passkey);
bool bt_security_request_callback();
void bt_authentication_complete_callback(esp_ble_auth_cmpl_t auth_result);
bool bt_confirm_pin_callback(uint32_t pin);
void bt_connect_callback(BLEServer *server);
void bt_disconnect_callback(BLEServer *server);
bool bt_client_authenticated();
uint32_t BLESerial::onPassKeyRequest() { return bt_passkey_callback(); }
void BLESerial::onPassKeyNotify(uint32_t passkey) { bt_passkey_notify_callback(passkey); }
bool BLESerial::onSecurityRequest() { return bt_security_request_callback(); }
void BLESerial::onAuthenticationComplete(esp_ble_auth_cmpl_t auth_result) { bt_authentication_complete_callback(auth_result); }
void BLESerial::onConnect(BLEServer *server) { bt_connect_callback(server); }
void BLESerial::onDisconnect(BLEServer *server) { bt_disconnect_callback(server); ble_server->startAdvertising(); }
bool BLESerial::onConfirmPIN(uint32_t pin) { return bt_confirm_pin_callback(pin); };
bool BLESerial::connected() { return ble_server->getConnectedCount() > 0; }
int BLESerial::read() {
int result = this->rx_buffer.pop();
if (result == '\n') { this->numAvailableLines--; }
return result;
}
size_t BLESerial::readBytes(uint8_t *buffer, size_t bufferSize) {
int i = 0;
while (i < bufferSize && available()) { buffer[i] = (uint8_t)this->rx_buffer.pop(); i++; }
return i;
}
int BLESerial::peek() {
if (this->rx_buffer.getLength() == 0) return -1;
return this->rx_buffer.get(0);
}
int BLESerial::available() { return this->rx_buffer.getLength(); }
size_t BLESerial::print(const char *str) {
if (ble_server->getConnectedCount() <= 0) return 0;
size_t written = 0; for (size_t i = 0; str[i] != '\0'; i++) { written += this->write(str[i]); }
flush();
return written;
}
size_t BLESerial::write(const uint8_t *buffer, size_t bufferSize) {
if (ble_server->getConnectedCount() <= 0) { return 0; } else {
size_t written = 0; for (int i = 0; i < bufferSize; i++) { written += this->write(buffer[i]); }
flush();
return written;
}
}
size_t BLESerial::write(uint8_t byte) {
if (bt_client_authenticated()) {
if (ble_server->getConnectedCount() <= 0) { return 0; } else {
this->transmitBuffer[this->transmitBufferLength] = byte;
this->transmitBufferLength++;
if (this->transmitBufferLength == maxTransferSize) { flush(); }
return 1;
}
} else {
return 0;
}
}
void BLESerial::flush() {
if (this->transmitBufferLength > 0) {
TxCharacteristic->setValue(this->transmitBuffer, this->transmitBufferLength);
this->transmitBufferLength = 0;
this->lastFlushTime = millis();
TxCharacteristic->notify(true);
}
}
void BLESerial::begin(const char *name) {
ConnectedDeviceCount = 0;
BLEDevice::init(name);
esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_DEFAULT, ESP_PWR_LVL_P9);
esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_ADV, ESP_PWR_LVL_P9);
esp_ble_tx_power_set(ESP_BLE_PWR_TYPE_SCAN ,ESP_PWR_LVL_P9);
ble_server = BLEDevice::createServer();
ble_server->setCallbacks(this);
BLEDevice::setEncryptionLevel(ESP_BLE_SEC_ENCRYPT_MITM);
BLEDevice::setSecurityCallbacks(this);
SetupSerialService();
ble_adv = BLEDevice::getAdvertising();
ble_adv->addServiceUUID(BLE_SERIAL_SERVICE_UUID);
ble_adv->setMinPreferred(0x20);
ble_adv->setMaxPreferred(0x40);
ble_adv->setScanResponse(true);
ble_adv->start();
}
void BLESerial::end() { BLEDevice::deinit(); }
void BLESerial::onWrite(BLECharacteristic *characteristic) {
if (characteristic->getUUID().toString() == BLE_RX_UUID) {
auto value = characteristic->getValue();
for (int i = 0; i < value.length(); i++) { rx_buffer.push(value[i]); }
}
}
void BLESerial::SetupSerialService() {
SerialService = ble_server->createService(BLE_SERIAL_SERVICE_UUID);
RxCharacteristic = SerialService->createCharacteristic(BLE_RX_UUID, BLECharacteristic::PROPERTY_WRITE);
RxCharacteristic->setAccessPermissions(ESP_GATT_PERM_WRITE_ENC_MITM);
RxCharacteristic->addDescriptor(new BLE2902());
RxCharacteristic->setWriteProperty(true);
RxCharacteristic->setCallbacks(this);
TxCharacteristic = SerialService->createCharacteristic(BLE_TX_UUID, BLECharacteristic::PROPERTY_NOTIFY);
TxCharacteristic->setAccessPermissions(ESP_GATT_PERM_READ_ENC_MITM);
TxCharacteristic->addDescriptor(new BLE2902());
TxCharacteristic->setNotifyProperty(true);
TxCharacteristic->setReadProperty(true);
SerialService->start();
}
BLESerial::BLESerial() { }
#endif
#endif

133
src/ble/BLESerial.h Normal file
View File

@ -0,0 +1,133 @@
// Copyright (C) 2024, Mark Qvist
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "../../Boards.h"
#if PLATFORM != PLATFORM_NRF52
#if HAS_BLE
#include <Arduino.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
#include <BLE2902.h>
template <size_t n>
class BLEFIFO {
private:
uint8_t buffer[n];
int head = 0;
int tail = 0;
public:
void push(uint8_t value) {
buffer[head] = value;
head = (head + 1) % n;
if (head == tail) { tail = (tail + 1) % n; }
}
int pop() {
if (head == tail) {
return -1;
} else {
uint8_t value = buffer[tail];
tail = (tail + 1) % n;
return value;
}
}
void clear() { head = 0; tail = 0; }
int get(size_t index) {
if (index >= this->getLength()) {
return -1;
} else {
return buffer[(tail + index) % n];
}
}
size_t getLength() {
if (head >= tail) {
return head - tail;
} else {
return n - tail + head;
}
}
};
#define RX_BUFFER_SIZE 6144
#define BLE_BUFFER_SIZE 512 // Must fit in max GATT attribute length
#define MIN_MTU 50
class BLESerial : public BLECharacteristicCallbacks, public BLEServerCallbacks, public BLESecurityCallbacks, public Stream {
public:
BLESerial();
void begin(const char *name);
void end();
void onWrite(BLECharacteristic *characteristic);
int available();
int peek();
int read();
size_t readBytes(uint8_t *buffer, size_t bufferSize);
size_t write(uint8_t byte);
size_t write(const uint8_t *buffer, size_t bufferSize);
size_t print(const char *value);
void flush();
void onConnect(BLEServer *server);
void onDisconnect(BLEServer *server);
uint32_t onPassKeyRequest();
void onPassKeyNotify(uint32_t passkey);
bool onSecurityRequest();
void onAuthenticationComplete(esp_ble_auth_cmpl_t);
bool onConfirmPIN(uint32_t pin);
bool connected();
BLEServer *ble_server;
BLEAdvertising *ble_adv;
BLEService *SerialService;
BLECharacteristic *TxCharacteristic;
BLECharacteristic *RxCharacteristic;
size_t transmitBufferLength;
unsigned long long lastFlushTime;
private:
BLESerial(BLESerial const &other) = delete;
void operator=(BLESerial const &other) = delete;
BLEFIFO<RX_BUFFER_SIZE> rx_buffer;
size_t numAvailableLines;
uint8_t transmitBuffer[BLE_BUFFER_SIZE];
int ConnectedDeviceCount;
void SetupSerialService();
uint16_t peerMTU;
uint16_t maxTransferSize = BLE_BUFFER_SIZE;
bool checkMTU();
const char *BLE_SERIAL_SERVICE_UUID = "6e400001-b5a3-f393-e0a9-e50e24dcca9e";
const char *BLE_RX_UUID = "6e400002-b5a3-f393-e0a9-e50e24dcca9e";
const char *BLE_TX_UUID = "6e400003-b5a3-f393-e0a9-e50e24dcca9e";
bool started = false;
};
#endif
#endif

440
src/display/ST7789.h Normal file
View File

@ -0,0 +1,440 @@
/**
* The MIT License (MIT)
*
* Copyright (c) 2018 by ThingPulse, Daniel Eichhorn
* Copyright (c) 2018 by Fabrice Weinberg
* Copyright (c) 2024 by Heltec AutoMation
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* ThingPulse invests considerable time and money to develop these open source libraries.
* Please support us by buying our products (and not the clones) from
* https://thingpulse.com
*
*/
#ifndef ST7789Spi_h
#define ST7789Spi_h
#include "OLEDDisplay.h"
#include <SPI.h>
#define ST_CMD_DELAY 0x80 // special signifier for command lists
#define ST77XX_NOP 0x00
#define ST77XX_SWRESET 0x01
#define ST77XX_RDDID 0x04
#define ST77XX_RDDST 0x09
#define ST77XX_SLPIN 0x10
#define ST77XX_SLPOUT 0x11
#define ST77XX_PTLON 0x12
#define ST77XX_NORON 0x13
#define ST77XX_INVOFF 0x20
#define ST77XX_INVON 0x21
#define ST77XX_DISPOFF 0x28
#define ST77XX_DISPON 0x29
#define ST77XX_CASET 0x2A
#define ST77XX_RASET 0x2B
#define ST77XX_RAMWR 0x2C
#define ST77XX_RAMRD 0x2E
#define ST77XX_PTLAR 0x30
#define ST77XX_TEOFF 0x34
#define ST77XX_TEON 0x35
#define ST77XX_MADCTL 0x36
#define ST77XX_COLMOD 0x3A
#define ST77XX_MADCTL_MY 0x80
#define ST77XX_MADCTL_MX 0x40
#define ST77XX_MADCTL_MV 0x20
#define ST77XX_MADCTL_ML 0x10
#define ST77XX_MADCTL_RGB 0x00
#define ST77XX_RDID1 0xDA
#define ST77XX_RDID2 0xDB
#define ST77XX_RDID3 0xDC
#define ST77XX_RDID4 0xDD
// Some ready-made 16-bit ('565') color settings:
#define ST77XX_BLACK 0x0000
#define ST77XX_WHITE 0xFFFF
#define ST77XX_RED 0xF800
#define ST77XX_GREEN 0x07E0
#define ST77XX_BLUE 0x001F
#define ST77XX_CYAN 0x07FF
#define ST77XX_MAGENTA 0xF81F
#define ST77XX_YELLOW 0xFFE0
#define ST77XX_ORANGE 0xFC00
#define LED_A_ON LOW
#ifdef ESP_PLATFORM
#undef LED_A_ON
#define LED_A_ON HIGH
#define rtos_free free
#define rtos_malloc malloc
//SPIClass SPI1(HSPI);
#endif
class ST7789Spi : public OLEDDisplay {
private:
uint8_t _rst;
uint8_t _dc;
uint8_t _cs;
uint8_t _ledA;
int _miso;
int _mosi;
int _clk;
SPIClass * _spi;
SPISettings _spiSettings;
uint16_t _RGB=0xFFFF;
uint8_t _buffheight;
public:
/* pass _cs as -1 to indicate "do not use CS pin", for cases where it is hard wired low */
ST7789Spi(SPIClass *spiClass,uint8_t _rst, uint8_t _dc, uint8_t _cs, OLEDDISPLAY_GEOMETRY g = GEOMETRY_RAWMODE,uint16_t width=240,uint16_t height=320,int mosi=-1,int miso=-1,int clk=-1) {
this->_spi = spiClass;
this->_rst = _rst;
this->_dc = _dc;
this->_cs = _cs;
this->_mosi=mosi;
this->_miso=miso;
this->_clk=clk;
//this->_ledA = _ledA;
_spiSettings = SPISettings(40000000, MSBFIRST, SPI_MODE0);
setGeometry(g,width,height);
}
bool connect(){
this->_buffheight=displayHeight / 8;
this->_buffheight+=displayHeight % 8 ? 1:0;
pinMode(_cs, OUTPUT);
pinMode(_dc, OUTPUT);
//pinMode(_ledA, OUTPUT);
if (_cs != (uint8_t) -1) {
pinMode(_cs, OUTPUT);
}
pinMode(_rst, OUTPUT);
#ifdef ESP_PLATFORM
_spi->begin(_clk,_miso,_mosi,-1);
#else
_spi->begin();
#endif
_spi->setClockDivider (SPI_CLOCK_DIV2);
// Pulse Reset low for 10ms
digitalWrite(_rst, HIGH);
delay(1);
digitalWrite(_rst, LOW);
delay(10);
digitalWrite(_rst, HIGH);
_spi->begin ();
//digitalWrite(_ledA, LED_A_ON);
return true;
}
void display(void) {
#ifdef OLEDDISPLAY_DOUBLE_BUFFER
uint16_t minBoundY = UINT16_MAX;
uint16_t maxBoundY = 0;
uint16_t minBoundX = UINT16_MAX;
uint16_t maxBoundX = 0;
uint16_t x, y;
// Calculate the Y bounding box of changes
// and copy buffer[pos] to buffer_back[pos];
for (y = 0; y < _buffheight; y++) {
for (x = 0; x < displayWidth; x++) {
//Serial.printf("x %d y %d\r\n",x,y);
uint16_t pos = x + y * displayWidth;
if (buffer[pos] != buffer_back[pos]) {
minBoundY = min(minBoundY, y);
maxBoundY = max(maxBoundY, y);
minBoundX = min(minBoundX, x);
maxBoundX = max(maxBoundX, x);
}
buffer_back[pos] = buffer[pos];
}
yield();
}
// If the minBoundY wasn't updated
// we can savely assume that buffer_back[pos] == buffer[pos]
// holdes true for all values of pos
if (minBoundY == UINT16_MAX) return;
set_CS(LOW);
_spi->beginTransaction(_spiSettings);
for (y = minBoundY; y <= maxBoundY; y++)
{
for(int temp = 0; temp<8;temp++)
{
//setAddrWindow(minBoundX,y*8+temp,maxBoundX-minBoundX+1,1);
setAddrWindow(minBoundX,y*8+temp,maxBoundX-minBoundX+1,1);
//setAddrWindow(y*8+temp,minBoundX,1,maxBoundX-minBoundX+1);
uint32_t const pixbufcount = maxBoundX-minBoundX+1;
uint16_t *pixbuf = (uint16_t *)rtos_malloc(2 * pixbufcount);
for (x = minBoundX; x <= maxBoundX; x++)
{
pixbuf[x-minBoundX] = ((buffer[x + y * displayWidth]>>temp)&0x01)==1?_RGB:0;
}
#ifdef ESP_PLATFORM
_spi->transferBytes((uint8_t *)pixbuf, NULL, 2 * pixbufcount);
#else
_spi->transfer(pixbuf, NULL, 2 * pixbufcount);
#endif
rtos_free(pixbuf);
}
}
_spi->endTransaction();
set_CS(HIGH);
#else
set_CS(LOW);
_spi->beginTransaction(_spiSettings);
uint8_t x, y;
for (y = 0; y < _buffheight; y++)
{
for(int temp = 0; temp<8;temp++)
{
//setAddrWindow(minBoundX,y*8+temp,maxBoundX-minBoundX+1,1);
//setAddrWindow(minBoundX,y*8+temp,maxBoundX-minBoundX+1,1);
setAddrWindow(y*8+temp,0,1,displayWidth);
uint32_t const pixbufcount = displayWidth;
uint16_t *pixbuf = (uint16_t *)rtos_malloc(2 * pixbufcount);
for (x = 0; x < displayWidth; x++)
{
pixbuf[x] = ((buffer[x + y * displayWidth]>>temp)&0x01)==1?_RGB:0;
}
#ifdef ESP_PLATFORM
_spi->transferBytes((uint8_t *)pixbuf, NULL, 2 * pixbufcount);
#else
_spi->transfer(pixbuf, NULL, 2 * pixbufcount);
#endif
rtos_free(pixbuf);
}
}
_spi->endTransaction();
set_CS(HIGH);
#endif
}
virtual void resetOrientation() {
uint8_t madctl = ST77XX_MADCTL_RGB|ST77XX_MADCTL_MV|ST77XX_MADCTL_MX;
sendCommand(ST77XX_MADCTL);
WriteData(madctl);
delay(10);
}
virtual void flipScreenVertically() {
uint8_t madctl = ST77XX_MADCTL_RGB|ST77XX_MADCTL_MV|ST77XX_MADCTL_MY;
sendCommand(ST77XX_MADCTL);
WriteData(madctl);
delay(10);
}
virtual void mirrorScreen() {
uint8_t madctl = ST77XX_MADCTL_RGB|ST77XX_MADCTL_MV|ST77XX_MADCTL_MX|ST77XX_MADCTL_MY;
sendCommand(ST77XX_MADCTL);
WriteData(madctl);
delay(10);
}
virtual void setRotation(uint8_t r) {
uint8_t madctl = ST77XX_MADCTL_RGB|ST77XX_MADCTL_MV|ST77XX_MADCTL_MX;
if (r == 1) { madctl = 0xC0; }
if (r == 2) { madctl = ST77XX_MADCTL_RGB|ST77XX_MADCTL_MV|ST77XX_MADCTL_MY; }
if (r == 3) { madctl = 0x00; }
sendCommand(ST77XX_MADCTL);
WriteData(madctl);
delay(10);
}
void setRGB(uint16_t c)
{
this->_RGB=0x00|c>>8|c<<8&0xFF00;
}
void displayOn(void) {
//sendCommand(DISPLAYON);
}
void displayOff(void) {
//sendCommand(DISPLAYOFF);
}
//#define ST77XX_MADCTL_MY 0x80
//#define ST77XX_MADCTL_MX 0x40
//#define ST77XX_MADCTL_MV 0x20
//#define ST77XX_MADCTL_ML 0x10
protected:
// Send all the init commands
virtual void sendInitCommands()
{
sendCommand(ST77XX_SWRESET); // 1: Software reset, no args, w/delay
delay(150);
sendCommand(ST77XX_SLPOUT); // 2: Out of sleep mode, no args, w/delay
delay(10);
sendCommand(ST77XX_COLMOD); // 3: Set color mode, 16-bit color
WriteData(0x55);
delay(10);
sendCommand(ST77XX_MADCTL); // 4: Mem access ctrl (directions), Row/col addr, bottom-top refresh
WriteData(0x08);
sendCommand(ST77XX_CASET); // 5: Column addr set,
WriteData(0x00);
WriteData(0x00); // XSTART = 0
WriteData(0x00);
WriteData(240); // XEND = 240
sendCommand(ST77XX_RASET); // 6: Row addr set,
WriteData(0x00);
WriteData(0x00); // YSTART = 0
WriteData(320>>8);
WriteData(320&0xFF); // YSTART = 320
sendCommand(ST77XX_SLPOUT); // 7: hack
delay(10);
sendCommand(ST77XX_NORON); // 8: Normal display on, no args, w/delay
delay(10);
sendCommand(ST77XX_DISPON); // 9: Main screen turn on, no args, delay
delay(10);
sendCommand(ST77XX_INVON); // 10: invert
delay(10);
//uint8_t madctl = ST77XX_MADCTL_RGB|ST77XX_MADCTL_MX;
uint8_t madctl = ST77XX_MADCTL_RGB|ST77XX_MADCTL_MV|ST77XX_MADCTL_MX;
sendCommand(ST77XX_MADCTL);
WriteData(madctl);
delay(10);
setRGB(ST77XX_GREEN);
}
private:
void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
x += (320-displayWidth)/2;
y += (240-displayHeight)/2;
uint32_t xa = ((uint32_t)x << 16) | (x + w - 1);
uint32_t ya = ((uint32_t)y << 16) | (y + h - 1);
writeCommand(ST77XX_CASET); // Column addr set
SPI_WRITE32(xa);
writeCommand(ST77XX_RASET); // Row addr set
SPI_WRITE32(ya);
writeCommand(ST77XX_RAMWR); // write to RAM
}
int getBufferOffset(void) {
return 0;
}
inline void set_CS(bool level) {
if (_cs != (uint8_t) -1) {
digitalWrite(_cs, level);
}
};
inline void sendCommand(uint8_t com) __attribute__((always_inline)){
set_CS(HIGH);
digitalWrite(_dc, LOW);
set_CS(LOW);
_spi->beginTransaction(_spiSettings);
_spi->transfer(com);
_spi->endTransaction();
set_CS(HIGH);
digitalWrite(_dc, HIGH);
}
inline void WriteData(uint8_t data) __attribute__((always_inline)){
digitalWrite(_cs, LOW);
_spi->beginTransaction(_spiSettings);
_spi->transfer(data);
_spi->endTransaction();
digitalWrite(_cs, HIGH);
}
void SPI_WRITE32(uint32_t l)
{
_spi->transfer(l >> 24);
_spi->transfer(l >> 16);
_spi->transfer(l >> 8);
_spi->transfer(l);
}
void writeCommand(uint8_t cmd) {
digitalWrite(_dc, LOW);
_spi->transfer(cmd);
digitalWrite(_dc, HIGH);
}
// Private functions
void setGeometry(OLEDDISPLAY_GEOMETRY g, uint16_t width, uint16_t height) {
this->geometry = g;
switch (g) {
case GEOMETRY_128_128:
this->displayWidth = 128;
this->displayHeight = 128;
break;
case GEOMETRY_128_64:
this->displayWidth = 128;
this->displayHeight = 64;
break;
case GEOMETRY_128_32:
this->displayWidth = 128;
this->displayHeight = 32;
break;
case GEOMETRY_64_48:
this->displayWidth = 64;
this->displayHeight = 48;
break;
case GEOMETRY_64_32:
this->displayWidth = 64;
this->displayHeight = 32;
break;
case GEOMETRY_RAWMODE:
this->displayWidth = width > 0 ? width : 128;
this->displayHeight = height > 0 ? height : 64;
break;
}
uint8_t tmp=displayHeight % 8;
uint8_t _buffheight=displayHeight / 8;
if(tmp!=0)
_buffheight++;
this->displayBufferSize = displayWidth * _buffheight ;
}
};
#endif

95
src/misc/FIFOBuffer.c Normal file
View File

@ -0,0 +1,95 @@
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "FIFOBuffer.h"
#ifdef __cplusplus
extern "C" {
#endif
bool fifo_isempty(const FIFOBuffer *f) {
return f->head == f->tail;
}
bool fifo_isfull(const FIFOBuffer *f) {
return ((f->head == f->begin) && (f->tail == f->end)) || (f->tail == f->head - 1);
}
void fifo_push(FIFOBuffer *f, unsigned char c) {
*(f->tail) = c;
if (f->tail == f->end) {
f->tail = f->begin;
} else {
f->tail++;
}
}
unsigned char fifo_pop(FIFOBuffer *f) {
if(f->head == f->end) {
f->head = f->begin;
return *(f->end);
} else {
return *(f->head++);
}
}
void fifo_flush(FIFOBuffer *f) {
f->head = f->tail;
}
void fifo_init(FIFOBuffer *f, unsigned char *buffer, size_t size) {
f->head = f->tail = f->begin = buffer;
f->end = buffer + size;
}
// todo, fix this so it actually displays the amount of data in the fifo
// buffer, not just the size allocated for the buffer
size_t fifo_len(FIFOBuffer *f) {
return f->end - f->begin;
}
bool fifo16_isempty(const FIFOBuffer16 *f) {
return f->head == f->tail;
}
bool fifo16_isfull(const FIFOBuffer16 *f) {
return ((f->head == f->begin) && (f->tail == f->end)) || (f->tail == f->head - 1);
}
void fifo16_push(FIFOBuffer16 *f, uint16_t c) {
*(f->tail) = c;
if (f->tail == f->end) {
f->tail = f->begin;
} else {
f->tail++;
}
}
uint16_t fifo16_pop(FIFOBuffer16 *f) {
if(f->head == f->end) {
f->head = f->begin;
return *(f->end);
} else {
return *(f->head++);
}
}
void fifo16_flush(FIFOBuffer16 *f) {
f->head = f->tail;
}
void fifo16_init(FIFOBuffer16 *f, uint16_t *buffer, uint16_t size) {
f->head = f->tail = f->begin = buffer;
f->end = buffer + size;
}
uint16_t fifo16_len(FIFOBuffer16 *f) {
return (f->end - f->begin);
}
#ifdef __cplusplus
}
#endif

59
src/misc/FIFOBuffer.h Normal file
View File

@ -0,0 +1,59 @@
#ifndef FIFOBUFFER_H
#define FIFOBUFFER_H
#ifdef __cplusplus
extern "C" {
#endif
/* An 8 bit FIFO buffer implementation */
typedef struct FIFOBuffer
{
unsigned char *begin;
unsigned char *end;
unsigned char * volatile head;
unsigned char * volatile tail;
} FIFOBuffer;
bool fifo_isempty(const FIFOBuffer *f);
bool fifo_isfull(const FIFOBuffer *f);
void fifo_push(FIFOBuffer *f, unsigned char c);
unsigned char fifo_pop(FIFOBuffer *f);
void fifo_flush(FIFOBuffer *f);
void fifo_init(FIFOBuffer *f, unsigned char *buffer, size_t size);
size_t fifo_len(FIFOBuffer *f);
/* A 16-bit implementation of the same FIFO buffer. */
typedef struct FIFOBuffer16
{
uint16_t *begin;
uint16_t *end;
uint16_t * volatile head;
uint16_t * volatile tail;
} FIFOBuffer16;
bool fifo16_isempty(const FIFOBuffer16 *f);
bool fifo16_isfull(const FIFOBuffer16 *f);
void fifo16_push(FIFOBuffer16 *f, uint16_t c);
uint16_t fifo16_pop(FIFOBuffer16 *f);
void fifo16_flush(FIFOBuffer16 *f);
void fifo16_init(FIFOBuffer16 *f, uint16_t *buffer, uint16_t size);
uint16_t fifo16_len(FIFOBuffer16 *f);
#ifdef __cplusplus
}
#endif
#endif

45
src/misc/ModemISR.h Normal file
View File

@ -0,0 +1,45 @@
extern RadioInterface* interface_obj[INTERFACE_COUNT];
void (*onIntRise[INTERFACE_COUNT]) (void);
#if INTERFACE_COUNT == 1
void onInt0Rise() {
if (interfaces[0] == SX1280) {
// On the SX1280, there is a bug which can cause the busy line
// to remain high if a high amount of packets are received when
// in continuous RX mode. This is documented as Errata 16.1 in
// the SX1280 datasheet v3.2 (page 149)
// Therefore, the modem is set into receive mode each time a packet is received.
interface_obj[0]->receive();
}
if (interface_obj[0]->getPacketValidity()) {
interface_obj[0]->handleDio0Rise();
}
}
void setup_interfaces() {
onIntRise[0] = onInt0Rise;
}
#elif BOARD_MODEL == BOARD_RAK4631 || BOARD_MODEL == BOARD_OPENCOM_XL
void onInt0Rise() {
if (interface_obj[0]->getPacketValidity()) {
interface_obj[0]->handleDio0Rise();
}
}
void onInt1Rise() {
// On the SX1280, there is a bug which can cause the busy line
// to remain high if a high amount of packets are received when
// in continuous RX mode. This is documented as Errata 16.1 in
// the SX1280 datasheet v3.2 (page 149)
// Therefore, the modem is set into receive mode each time a packet is received.
interface_obj[1]->receive();
if (interface_obj[1]->getPacketValidity()) {
interface_obj[1]->handleDio0Rise();
}
}
void setup_interfaces() {
onIntRise[0] = onInt0Rise;
onIntRise[1] = onInt1Rise;
}
#endif

8
src/misc/gps.h Normal file
View File

@ -0,0 +1,8 @@
#include <TinyGPSPlus.h>
#include <SoftwareSerial.h>
#define GPS_INTERVAL 5000 // ms
unsigned long last_gps = 0;
TinyGPSPlus gps;
SoftwareSerial gps_s(PIN_GPS_RX, PIN_GPS_TX);