Compare commits

..
748 Commits
Author SHA1 Message Date
Scott Powell d4eb9df491 Merge branch 'dev' 2025-05-24 17:40:52 +10:00
Scott Powell f8eb6afdb0 * ver bump to 1.6.2 2025-05-24 16:19:19 +10:00
ripplebiz f7780bb4df Merge pull request #330 from recrof/dev
heltec wireless tracker: added repeater and room server roles
2025-05-24 15:11:39 +10:00
recrof 324a2ce95f added repeater and room server roles to heltec wireless tracker 2025-05-24 07:05:33 +02:00
ripplebiz 1679781963 Merge pull request #329 from ngavars/xiao-nrf-sensors
Add sensor support to Xiao Nrf
2025-05-24 14:23:43 +10:00
ripplebiz 3a2c5e6e53 Merge pull request #327 from seagull9000/RTTTL-tone-for-Channel-Message
RTTTL-tone-for-Channel-Message
2025-05-24 14:16:30 +10:00
Normunds Gavars b0605443b6 Add sensor support to Xiao Nrf 2025-05-23 21:24:02 +03:00
Scott Powell 985d46f9bc * EnvironmentSensorManager: some tidy ups 2025-05-23 19:12:32 +10:00
ripplebiz eb7e0afb9d Merge pull request #321 from oltaco/sensor-class-with-gps
GPS support added to EnvironmentSensorClass
2025-05-23 19:05:02 +10:00
taco 31b29e84f7 refactor: more conditionals for GPS
also re-added some missing returns.
2025-05-23 18:58:45 +10:00
seagull9000 5905f99fe7 Merge branch 'RTTTL-tone-for-Channel-Message' of https://github.com/seagull9000/MeshCore into RTTTL-tone-for-Channel-Message 2025-05-23 20:44:42 +12:00
seagull9000 cbe51d366d Merge branch 'RTTTL-tone-for-Channel-Message' of https://github.com/seagull9000/MeshCore into RTTTL-tone-for-Channel-Message 2025-05-23 20:44:00 +12:00
seagull9000 0f958078e5 Merge branch 'RTTTL-tone-for-Channel-Message' of https://github.com/seagull9000/MeshCore into RTTTL-tone-for-Channel-Message 2025-05-23 20:42:44 +12:00
seagull9000 f226a48886 RTTTL-tone-for-Channel-Message
I was a bit remiss in removing the tone for channel message event - this puts one in.

So: DM event - plays a tone (per current)
      Channel Message - new shorter tone

All others aren't defined at present.  Need muting function before we get too carried away.
2025-05-23 20:32:52 +12:00
taco 18ccee7f17 REFACTOR: sensors are now wrapped in conditionals 2025-05-23 17:08:23 +10:00
seagull9000 ce6fbe7013 RTTTL-tone-for-Channel-Message
I was a bit remiss in removing the tone for channel message event - this puts one in.

So: DM event - plays a tone (per current)
      Channel Message - new shorter tone

All others aren't defined at present.  Need muting function before we get too carried away.
2025-05-23 17:58:13 +12:00
taco 788dc65a56 fix: remove stray initSerialGPS call 2025-05-23 14:34:34 +10:00
ripplebiz ee20d84ee2 Merge pull request #322 from fdlamotte/rak3x72
rak3x72 : first commit
2025-05-23 13:45:31 +10:00
ripplebiz bb5dcce504 Merge pull request #289 from adam2872/RAK4631-user-button
Implement user button on RAK4631 using analogue pin 31 (same as MT)
2025-05-23 13:19:32 +10:00
Florent de Lamotte 5b85f5950f rak3x72 : report bat voltage 2025-05-22 16:24:20 +02:00
Florent 9a4acf47d0 rak3x72 : first commit 2025-05-22 14:47:44 +02:00
ripplebiz a3b874a5aa Merge pull request #305 from ngavars/dev
Telemetry: Create sensor classes that can be shared across variants
2025-05-22 15:46:28 +10:00
taco 68c2f1c864 added serial GPS support to EnvironmentSensorClass
based on T114 serial GPS and EnvironmentSensorClass.
2025-05-22 15:36:20 +10:00
Scott Powell ccc5ec1aa9 * Companion: telemetry_mode_env added to prefs 2025-05-22 15:26:30 +10:00
Normunds Gavars 920e0dc10c Remove NUM_SENSOR_SETTINGS 2025-05-22 00:38:51 +03:00
Normunds Gavars d804e46dd3 Add sensors to build path for ProMicroLLCC68 2025-05-22 00:35:03 +03:00
Normunds Gavars 8391c7fa0d Remove INA219 wrapper 2025-05-22 00:28:20 +03:00
Normunds Gavars e248aa88f2 Remove unused defines 2025-05-22 00:22:43 +03:00
Normunds Gavars 66ef5c38ae Remove sensor wrapper classes and simplify. Switch to Adafruit libs for sensors. 2025-05-22 00:19:00 +03:00
ripplebiz 6894ca08e7 Merge pull request #317 from webmonkey/webmonkey-faq-proofread
Proof-reading fixes to the FAQ
2025-05-21 13:54:00 +10:00
webmonkey 39119f5560 Small fixes 2025-05-20 21:42:36 +01:00
webmonkey 45bc8b0861 Proof-reading fixes to the FAQ
Fixed spelling and grammar issues. Also changed the number of stored Room server messages from 16 to 32
2025-05-20 19:24:20 +01:00
Adam Mealings 36fd724d7c added missing variable defs and pinmode 2025-05-20 15:16:56 +01:00
adam2872 66ed237c0c Merge branch 'Dev' into RAK4631-user-button 2025-05-20 14:25:01 +01:00
adam2872 259b2b0150 Merge branch 'ripplebiz:main' into main 2025-05-20 14:00:24 +01:00
Adam Mealings 6cc79b0ec8 Updated to use #if defined... instead of #ifdef 2025-05-20 13:54:31 +01:00
ripplebiz 5019a79e7f Merge pull request #316 from recrof/dev
lilygo tbeam sx1276, tbeam supreme: added SX12XX_CURRENT_LIMIT
2025-05-20 22:24:08 +10:00
recrof a91976d33e fix: missing SX126X_CURRENT_LIMIT 2025-05-20 14:20:42 +02:00
recrof 42aaf7bd17 lilygo tbeam sx1276: forgot to add SX127X_CURRENT_LIMIT=120 2025-05-20 14:05:11 +02:00
ripplebiz ba72a7cae1 Merge pull request #315 from liamcottle/feature/companion-advert-name
Set default companion node name via build flags
2025-05-20 19:46:22 +10:00
liamcottle 4f35c84c7c allow setting default node name for companion via build flag 2025-05-20 20:51:46 +12:00
ripplebiz 51e4a89677 Merge pull request #314 from seagull9000/RTTTL-tweaks1
RTTTL on message types
2025-05-20 17:44:19 +10:00
seagull9000 2042033bf6 fix location and naming of enum 2025-05-20 19:33:21 +12:00
seagull9000 a719466871 RTTTL on message types 2025-05-20 19:09:49 +12:00
Scott Powell 9ea6f91c09 * workaround for nRF + LittleFS glitch with seek/truncate 2025-05-20 16:29:09 +10:00
ripplebiz 9df9b1cc7d Merge pull request #313 from 446564/ext-notify-nano-g2
enable external notify for nano g2 ultra
2025-05-20 16:13:35 +10:00
Rob Loranger 1adac52f52 enable external notify for nano g2 ultra
uses new non blocking rtttl
2025-05-19 19:28:44 -07:00
Scott Powell 30a6b12196 * refactored buzzer concept to UITask
* moved buzzer.h/cpp to helpers/ui
2025-05-20 11:52:55 +10:00
ripplebiz 857d205eb8 Merge pull request #312 from seagull9000/RTTTL-generic-buzzer
initial support for generic RTTTL (Ring Tone Transfer Language) notifier
2025-05-20 11:34:53 +10:00
seagull9000 ebf57ecf3c initial support for generic RTTTL notifier 2025-05-20 13:26:40 +12:00
ripplebiz 759ff6e947 Merge pull request #310 from 446564/nano-g2-gps
add GPS for nano g2
2025-05-20 11:02:22 +10:00
ripplebiz b83bc997b5 Merge pull request #306 from AndreaCCIE/T114-GPS-fix
Increase the delay to 1500 to allow enough time for T114 GPS to start up successfully.
2025-05-20 10:52:57 +10:00
Rob Loranger 26ec8437cc add GPS for nano g2
hardcoded interval of 1 minute after first fix obtained
2025-05-19 15:19:54 -07:00
Normunds Gavars ba4dbfbe66 Remove unnecessary include 2025-05-19 20:30:58 +03:00
Normunds Gavars d55b2527be Telemetry: Create BME280 sensor that can bu used across variants. Add to promicro. 2025-05-19 19:37:30 +03:00
AndreaB aab47c6a8f Increase the delay to 1500 to allow enough time for T114 GPS to start up successfully. 2025-05-19 16:52:24 +01:00
Normunds Gavars a7c7de4ffa Create sensor classes that can be shared across variants 2025-05-19 17:24:54 +03:00
Scott Powell 28c5086082 * bug fix for CommonCLI, when entering long unknown command 2025-05-19 23:39:34 +10:00
Scott Powell 5aa2ed8035 * AdvertDataHelpers: reverting parsing logic, but changed meanings of 'battery' and 'temperature' to just two generic uint16 'feature' properties 2025-05-19 23:21:57 +10:00
Scott Powell f0c5f828d9 * AdvertDataHelpers: prospective changes to first byte bit-field 2025-05-19 22:40:53 +10:00
ripplebiz 3ea9c498b8 Merge pull request #290 from adam2872/Modern-battery-icon
Slightly better battery icon
2025-05-19 14:30:16 +10:00
Scott Powell 19d506f4b3 * big refactor of the 'display' object. Now defined in variants/*/target modules. 2025-05-19 14:16:55 +10:00
ripplebiz 30439321e9 Merge pull request #298 from 446564/add-nano-g2-ultra
Initial support for nano g2 ultra
2025-05-19 11:09:02 +10:00
ripplebiz 49d727ee9b Merge pull request #300 from cod3doomy/dev
t-beam supreme: PMU and i2c fixes
2025-05-19 10:56:42 +10:00
ripplebiz 18052a67bf Merge pull request #301 from memo-567/Removes-green-LED-continuous-light
Removes T114 green LED continuous light
2025-05-19 10:53:23 +10:00
ripplebiz 0f0d005767 Merge pull request #304 from jquatier/altitude-telemetry
Add altitude to GPS telemetry
2025-05-19 10:50:31 +10:00
JQ b25060fc8e fix altitude for telemetry, instead of using zero 2025-05-18 16:36:45 -07:00
cod3doomy 23fe4f9c74 t-beam supreme: debug move
Moved scanDevices into ifdef MESH_DEBUG since it only needs to run under debug sequence
2025-05-18 10:20:32 -07:00
Scott Powell b816e3c75d * possible bug when forwarding direct mode packets 2025-05-18 21:22:27 +10:00
Memo 96061225ad Update variant.h 2025-05-18 06:14:08 +00:00
cod3doomy 66abb91981 t-beam supreme: PMU and i2c fixes
Fixed i2c (Wire) init issue by defining pins in platformio
Added an i2c scanning function for debug
Corrected the pmu power up sequence
2025-05-17 22:01:13 -07:00
Rob Loranger adb322a1eb Initial support for nano g2 ultra
not yet implemented are GPS and external notification LED and buzzer
2025-05-17 14:18:37 -07:00
Scott Powell 3b6d4b4726 Merge branch 'main' into dev 2025-05-18 01:31:27 +10:00
ripplebiz 56fc5d3264 Merge pull request #297 from liamcottle/docs/readme-update
A few adjustments to the readme
2025-05-18 01:29:33 +10:00
liamcottle 3401df8563 fix formatting 2025-05-18 02:54:53 +12:00
liamcottle ca8965eff4 update get support 2025-05-18 02:53:05 +12:00
liamcottle 2df3df77bd update how to get started 2025-05-18 02:47:09 +12:00
liamcottle 329649b33d adjust getting started info 2025-05-18 02:26:53 +12:00
liamcottle 576d53b7ff add info about flasher and clients 2025-05-18 02:18:32 +12:00
ripplebiz 2fbb1b41bb Merge pull request #294 from 446564/SH1106-display
Sh1106 display
2025-05-17 23:32:14 +10:00
ripplebiz 8769c3873c Merge pull request #293 from ngavars/dev
Telemetry: add support of AHT10/AHT20 temp/humidity sensor to Promicro
2025-05-17 22:35:03 +10:00
ripplebiz 80a8255d3b Merge pull request #295 from LitBomb/patch-10
Update faq.md to undo a merge from the dev branch that should not have included the faq.md file, update to note both SF 10 and SF 11 are viable
2025-05-17 21:54:43 +10:00
Scott Powell ed205e403b * ver bump to v1.6.1 2025-05-17 20:04:55 +10:00
Scott Powell 5de2f0edad * BLE_WRITE_MIN_INTERVAL upped to 60 millis 2025-05-17 19:54:31 +10:00
uncle lit a688fdd095 Update faq.md
revert a bad merge https://github.com/ripplebiz/MeshCore/commit/1451f8753671c06007a91678d378a290084ec3e1 in main that wiped out the last changes to faq.md

Update to note both SF 10 and SF 11 can be used based on local use case needs.  There are presets in Liam's smartphone apps for both SF 10 and SF 11.
2025-05-16 17:09:17 -07:00
Rob Loranger 80101684d5 add support for SH1106 OLED display 2025-05-16 08:45:55 -07:00
Normunds Gavars ec755a539b Telemetry: add support of AHT10/AHT20 temp/humidity sensor to Promicro 2025-05-16 15:03:42 +03:00
Scott Powell 61d000e3a6 * companion: fix for importContact(). Now removes the packet-hash from table, before 'replaying' 2025-05-16 19:57:09 +10:00
Scott Powell 1eff287609 * repeater: MAX_CLIENTS now defaults to 32 2025-05-15 20:36:09 +10:00
ripplebiz c23811e237 Merge pull request #287 from ngavars/dev
Promicro: add INA219 current sensor support
2025-05-15 14:37:37 +10:00
ripplebiz 7b38dca5fa Merge pull request #292 from cod3doomy/dev
t-beam supreme: enabled lora tx led
2025-05-15 14:32:32 +10:00
cod3doomy ddf5f5c013 t-beam supreme: enabled lora tx led
enabled lora tx led and verified it flashes with message transmit
2025-05-14 20:27:59 -07:00
Normunds Gavars d5655e4f0a Promicro: add support for INA219 current sensor 2025-05-15 00:21:51 +03:00
Adam Mealings c6e698f886 Make the battery fill based on the percentage slightly smaller to give it a more modern look 2025-05-14 22:17:54 +01:00
adam2872 16e3f6b897 Merge pull request #3 from adam2872/revert-2-RAK4631-user-button
Revert "RAK4631 analogue user button on input 31"
2025-05-14 22:05:23 +01:00
adam2872 2d631e21f9 Revert "RAK4631 analogue user button on input 31" 2025-05-14 22:04:28 +01:00
adam2872 5f3c68f8fd Merge pull request #2 from adam2872/RAK4631-user-button
RAK4631 analogue user button on input 31
2025-05-14 21:58:35 +01:00
Adam Mealings a4675adf66 RAK4631 analogue user button on input 31 2025-05-14 21:46:39 +01:00
Normunds Gavars de02c0c01f 283 Promicro: add INA3221 library dependency to all build targets 2025-05-14 18:19:53 +03:00
ripplebiz ed5d462b65 Merge pull request #285 from liamcottle/feature/offline-queue-increase
Increase offline queue size to 256 for all companion ble firmwares
2025-05-14 21:28:02 +10:00
Scott Powell 58f1ce55ab * Promicro: some refactors, minor fixes for INA3221 sensors 2025-05-14 21:22:26 +10:00
liamcottle 190a906450 fix offline queue size for xiao nrf52 2025-05-14 23:10:27 +12:00
ripplebiz 3193e8c3f2 Merge pull request #284 from ngavars/main
Telemetry: INA3221 current sensor support for Promicro
2025-05-14 21:07:22 +10:00
liamcottle 19a293ca09 increase offline queue size from 16 to 256 for all companion ble firmwares 2025-05-14 23:02:49 +12:00
Normunds Gavars a614fe2cb2 283 minor cleanup 2025-05-14 13:58:52 +03:00
Normunds Gavars 2b91bde4a9 283 add new permision for access to environment sensors 2025-05-14 13:55:45 +03:00
Normunds Gavars 016072e45a 283 remove settingsManager and avoid the String class 2025-05-14 13:27:57 +03:00
Scott Powell 71b93bfe5a * Dispatcher::checkSend() bug: getOutboundCount() should only count non-future packets 2025-05-14 16:50:11 +10:00
Scott Powell 423049b4e0 * TBeam Supreme: refactor for readStringUntil() 2025-05-14 13:11:10 +10:00
ripplebiz 73fb13fd02 Merge pull request #281 from cod3doomy/dev
t-beam supreme: added GPS functionality
2025-05-14 12:46:22 +10:00
Normunds Gavars 9d567674a2 Merge pull request #1 from ngavars/promicro-INA3221
283 Add support of INA3221 to Promicro telemetry
2025-05-13 23:57:08 +03:00
Normunds Gavars dbd90ec41a 283 Add support of INA3221 to Promicro telemetry 2025-05-13 23:52:49 +03:00
Scott Powell 2fef457f32 * CommonCLI: added "clear stats" command 2025-05-13 18:12:58 +10:00
cod3doomy 9443ef73fb t-beam supreme: added GPS functionality
Enabled GPS and verified with meshcli.
All supreme envs build.
2025-05-12 23:21:37 -07:00
Scott Powell 16df8c33a2 * Repeater/Room server: new diagnostics, stats.n_full_events now repurposed to 'err_events' (bit flags)
* new Radio::isInRecvMode() method
2025-05-13 15:38:10 +10:00
Scott Powell 74d9648b23 * T114: lib_deps missing MicroNMEA 2025-05-12 19:20:02 +10:00
ripplebiz f9b18a0fd4 Merge pull request #274 from hank/tbeamsupreme-pmu-fix-1
Fixes to the TBeam Supreme PMU calls
2025-05-12 19:08:34 +10:00
ripplebiz 6499913136 Merge pull request #273 from recrof/dev
raise current limit to max for sx126x and sx127x
2025-05-12 18:36:39 +10:00
recrof 20ed6d072f raise current limit to max for sx126x and sx127x 2025-05-12 10:19:33 +02:00
hank 7edccad2f9 Disabling MESH_DEBUG by default on TBeam Supreme companion 2025-05-12 01:17:28 -07:00
hank 04540f9d16 Fixes to the PMU calls 2025-05-12 01:09:16 -07:00
Scott Powell 0ec236e6c6 * startSendRaw() now returns false if fail 2025-05-12 17:26:44 +10:00
ripplebiz 9889cfb32b Merge pull request #268 from jquatier/t114-blue-led
Disable LED flashing during BLE advertising on T114
2025-05-12 12:42:12 +10:00
Scott Powell 80ac2e8bc0 * repeater: neighbors CLI, now returns secs ago, not timestamp 2025-05-12 12:23:58 +10:00
ripplebiz 4967970592 Merge pull request #266 from jquatier/t114-gps
T114 GPS Support
2025-05-12 10:06:14 +10:00
ripplebiz 976b7285e5 Merge pull request #264 from recrof/patch-1
tbeam supreme companion: raise channels to 8
2025-05-12 10:03:07 +10:00
JQ aab802d7ea don't expose GPD setting unless GPS is connected. 2025-05-11 09:32:34 -07:00
ripplebiz 6be47afd1d Merge pull request #269 from fdlamotte/wio-e5
wio-e5 : initial port
2025-05-11 20:00:13 +10:00
Florent a350d715a3 wio-e5 : initial port 2025-05-11 09:28:15 +02:00
Jacob Quatier cfff7a887b Disable LED flashing during BLE advertising 2025-05-10 20:47:13 -07:00
JQ 51199ddd6e remove debug 2025-05-09 20:31:28 -07:00
JQ c1ac5c1f55 t114 gps support 2025-05-09 20:30:11 -07:00
Rastislav Vysoky db0e85d9ed tbeam supreme companion: raise channels to 8 2025-05-09 16:22:31 +02:00
Scott Powell af7731a663 * ver bump to v1.6.0 2025-05-09 18:12:42 +10:00
Scott Powell 1899cfc7f9 * ESP32Board: can now download entire log file via OTA webserver (URL: /log) 2025-05-09 16:17:36 +10:00
Scott Powell 919a465c21 * Heltec tracker: new 'periph_power' shared pin (between Display & GPS) 2025-05-08 15:50:53 +10:00
Scott Powell 964c777795 * Heltec tracker: added GPS to custom HWTSensorManager 2025-05-08 13:55:09 +10:00
Scott Powell 188b145203 * refactor: LocationProvider classes moved to src/helpers/sensors
* refactor:  Heltec_Wireless_Tracker* env moved to new variants/heltec_tracker dir
2025-05-08 13:23:53 +10:00
Scott Powell 3e6f464aaa * ST7735Display: now applies SCALE_X, SCALE_Y 2025-05-08 12:48:34 +10:00
Scott Powell acdc2c5543 * Heltec Wireless Tracker fixes: getTextWidth() missing, PIN_BOARD_SDA/SCL 2025-05-08 12:42:28 +10:00
ripplebiz 983e729396 Merge pull request #258 from seagull9000/Heltec-Wireless-Tracker-support
Heltec Wireless Tracker support
2025-05-08 12:29:02 +10:00
ripplebiz e06cfa0d32 Merge pull request #255 from jquatier/bitmap-scaling-7789
fixing scaling of bitmaps for 7789 display
2025-05-08 11:33:49 +10:00
JQ 8a278ddb83 new implementation 2025-05-07 18:14:56 -07:00
seagull9000 9feb2b3e15 Heltec Wireless Tracker support 2025-05-07 21:42:29 +12:00
seagull9000 97b2b3e9a8 Heltec Wireless Tracker support 2025-05-07 21:40:27 +12:00
ripplebiz f804ae1605 Merge pull request #257 from liamcottle/fix/valid-ble-pin
ble pin must be zero or a valid 6 digit pin
2025-05-07 19:03:57 +10:00
liamcottle b914e3c915 ble pin must be zero or a valid 6 digit pin 2025-05-07 20:53:59 +12:00
ripplebiz 8fbce26eb6 Merge pull request #256 from liamcottle/feature/enable-repeater-neighbours
enable neighbours feature for all repeater variants
2025-05-07 18:34:05 +10:00
liamcottle e156096762 enable neighbours feature for all repeater variants 2025-05-07 20:26:15 +12:00
JQ 88e83474ab fixing scaling of bitmaps for 7789 display 2025-05-06 20:47:14 -07:00
Scott Powell cbe3bddd7b * refactor: removed mesh::Mesh dependency from CommonCLI 2025-05-06 11:51:51 +10:00
ripplebiz 2b1e6456a0 Merge pull request #246 from liamcottle/dev
Use identity key as default node name
2025-05-06 10:39:58 +10:00
ripplebiz 867cf6dd43 Merge pull request #251 from recrof/dev
Disable debug flags that were not commented out after debugging
2025-05-06 10:37:04 +10:00
ripplebiz 98dff3ef2e Merge pull request #250 from fdlamotte/fix_set_custom_var
fix for set_custom_var
2025-05-06 10:35:30 +10:00
Rastislav Vysoky 4aae54f24c Merge branch 'ripplebiz:dev' into dev 2025-05-05 22:48:56 +02:00
recrof 7ef5de4da0 disable debug flags that were not commented out after debugging 2025-05-05 22:48:21 +02:00
Florent de Lamotte d7fb7aa630 fix for set_custom_var 2025-05-05 16:40:00 +02:00
ripplebiz c8c57e0527 Merge pull request #249 from recrof/dev
lilygo t-echo, elecrow thinknode m1: correct display scalling
2025-05-05 19:30:39 +10:00
Rastislav Vysoky 202d8ae18a Delete src/helpers/CustomLR1121Wrapper.h 2025-05-05 08:34:41 +02:00
Rastislav Vysoky 388f44926b Delete src/helpers/CustomLR1121.h 2025-05-05 08:34:24 +02:00
recrof daa42f1f36 echo, m1: correct display scalling; all nrf52 boards jsons: added debug.openocd_target 2025-05-05 08:30:12 +02:00
Scott Powell 09c91f6721 * ST7789Display: now with SCALE_X,SCALE_Y
* fix for GxEPDDisplay
2025-05-05 15:54:31 +10:00
ripplebiz b3720bfde2 Merge pull request #248 from jquatier/t114-landscape
T114 landscape display
2025-05-05 15:43:35 +10:00
JQ afd3ffee3a T114 Landscape 2025-05-04 21:54:47 -07:00
JQ 478df9170e T114 Landscape 2025-05-04 21:51:58 -07:00
Scott Powell f31fb8c968 * GxEPDDIsplay: driver now applying SCALE_X, SCALE_Y 2025-05-05 13:37:48 +10:00
ripplebiz b7c33bc901 Merge pull request #243 from recrof/dev
initial support for Elecrow ThinkNode M1
2025-05-05 13:17:32 +10:00
Scott Powell 351b088194 * FIX: UI should show "< Room Server >" 2025-05-05 13:11:43 +10:00
ripplebiz ff4a432aef Merge pull request #247 from jquatier/ui-text-width
UI Text Width - minor improvement
2025-05-05 11:53:47 +10:00
Scott Powell e6764934c6 * companion: fix for _GET_STATUS response 2025-05-05 11:49:17 +10:00
Scott Powell fd5ac156bf * companion: protocol ver bump to 5
* companion: new prefs: telemetry_mode_base, telemetry_mode_loc
* companion: CMD_SET_OTHER_PARAMS, now optionally can set telemetry_modes
2025-05-05 11:21:55 +10:00
JQ 540401dd2e cleanup 2025-05-04 18:20:53 -07:00
JQ 8c0e86c171 Implement getTextWidth for display classes
- Added getTextWidth method to DisplayDriver interface
- Implemented getTextWidth in all display classes
- Updated examples to use getTextWidth directly
2025-05-04 18:17:18 -07:00
liamcottle 51c110923d no need for prefs check before prefs are loaded 2025-05-05 11:34:02 +12:00
liamcottle d319fd3eab use hex of first 4 bytes of identity public key as default node name 2025-05-05 11:21:31 +12:00
Scott Powell f4d8b559b5 * SensorManager: now can influence advert lat/lon, new custom name:value pairs for custom settings (eg, gps on/off)
* companion: new CMD_GET_CUSTOM_VARS, CMD_SET_CUSTOM_VAR
* T1000e: now supports "gps" custom setting (value "0" or "1")
2025-05-05 00:15:35 +10:00
ripplebiz 1083340bf8 Merge pull request #244 from fdlamotte/t1000e_telemetry_gps
t1000e quick and dirty integration of gps into telemetry framework
2025-05-04 23:46:59 +10:00
Florent 7ebc4fe9bf t1000e quick and dirty integration of gps into telemetry framework 2025-05-03 17:00:53 +02:00
recrof 7816413b89 initial support for Elecrow ThinkNode M1 2025-05-03 15:42:10 +02:00
recrof 86d6a40827 Merge branch 'dev' of github.com:recrof/MeshCore into dev 2025-05-03 14:59:06 +02:00
Scott Powell 314727537c * companion: new CMD_SEND_TELEMETRY_REQ, PUSH_CODE_TELEMETRY_RESPONSE 2025-05-03 20:08:44 +10:00
Scott Powell 2745f73f50 * new: SensorManager
* BasChatMesh: new onContactRequest(), for PAYLOAD_TYPE_REQ handling.
* companion, repeater and room_server: now with basic 'plumbing' to handle REQ_TYPE_GET_TELEMETRY_DATA (0x03).
* dependency: added CayenneLPP to libdeps
* all target.* modules now with a stub 'sensors' object.
2025-05-03 13:14:03 +10:00
ripplebiz 0cf2674079 Merge pull request #242 from fdlamotte/xiao-nrf52_pindef_in_config
xiao-nrf : move pindef to platformio.ini
2025-05-03 12:10:44 +10:00
Florent 0c2f895eaf xiao-nrf : move pindef in pio.ini 2025-05-02 08:27:26 +02:00
Scott Powell d759d62915 * repeater CLI: 'neighbors' command now responds with "-none-" if no neighbors 2025-05-02 13:24:06 +10:00
ripplebiz 1a36f98cd3 Merge pull request #213 from jquatier/ui-enhancements
Device UI Enhancements: Battery indicator, boot screen, radio settings
2025-05-02 11:32:09 +10:00
JQ 1451f87536 revert file 2025-05-01 18:29:25 -07:00
JQ 1c2d3ce786 merge from dev 2025-05-01 18:10:03 -07:00
ripplebiz 91ee7f4ea2 Merge pull request #237 from fdlamotte/t114_monochrome
T114 monochrome
2025-05-01 16:01:36 +10:00
ripplebiz 33b8e11f16 Merge pull request #229 from recrof/dev
build.sh: detect if we have nrf52 by probing for *.zip and *.hex output files
2025-05-01 12:01:25 +10:00
ripplebiz e2b21c085a Merge pull request #234 from fdlamotte/Arduino_serial_using_stream
use Stream abstract interface for serial port in ArduinoSerialInterface
2025-04-30 22:14:55 +10:00
Scott Powell 2035e9ff46 * refactor: "neighbors" command 2025-04-30 21:41:09 +10:00
Florent de Lamotte c8dc94cb97 t114 display : some fixes 2025-04-30 11:26:04 +02:00
Florent de Lamotte b6ce2847b0 Merge branch 'dev' into t114_monochrome 2025-04-30 11:11:01 +02:00
Florent de Lamotte a264bce2cc change screen rotation and fix bitmap 2025-04-30 11:09:43 +02:00
Scott Powell 195d9bfa33 * Repeater: neighbour table now only of other repeaters 2025-04-30 18:43:48 +10:00
Scott Powell 70f8569d21 * bug fix for CLI retry attempts (should be ignored) 2025-04-30 18:10:58 +10:00
Scott Powell 656292340c * repeater: new CLI command 'neighbors' 2025-04-30 18:01:30 +10:00
recrof 9cb958801d New Board: Elecrow ThinkNode M1 2025-04-29 17:32:08 +02:00
ripplebiz 43c304405e Merge pull request #232 from fdlamotte/xiao_s3_screen
add display to companion_radio_ble target
2025-04-29 15:50:25 +10:00
Florent de Lamotte 78467ad343 use Stream abstract interface for serial port in ArduinoSerialInterface 2025-04-28 16:17:29 +02:00
Florent de Lamotte eac48aad1f add display to companion_radio_ble target 2025-04-28 11:08:20 +02:00
Jacob Quatier b9d9a703ea Merge branch 'ripplebiz:main' into ui-enhancements 2025-04-27 20:37:49 -07:00
recrof 92e06ff3b8 detect if we have nrf52 by probing for *.zip and *.hex output files 2025-04-27 10:24:38 +02:00
ripplebiz 7a2869ddd0 Merge pull request #228 from liamcottle/dev
remove pin mode setup from uitask
2025-04-26 20:07:48 +10:00
ripplebiz dcd3707b67 Merge pull request #225 from alesgenova/short-led
companion_radio: greatly reduce the status LED usage
2025-04-26 17:27:03 +10:00
liamcottle 6ba70fd77e remove pin mode setup from uitask 2025-04-26 17:54:59 +12:00
Scott Powell 01cc957114 * Packet::readFrom() payload_len guard 2025-04-26 11:05:13 +10:00
ripplebiz 4ebaf8d793 Merge pull request #223 from neutralinsomniac/add_direnv_to_gitignore
Add .direnv/ to .gitignore. This is the directory that holds the nix-generated development environment
2025-04-25 19:28:12 +10:00
Alessandro Genova b412d74bab companion_radio: greatly reduce the status LED usage 2025-04-24 23:22:14 -04:00
Florent 079748fab4 some tests 2025-04-24 22:37:06 +02:00
Jeremy O'Brien 5e93326a94 Add .direnv/ to .gitignore. This is the directory that holds the nix-generated development environment 2025-04-24 12:22:52 -04:00
Scott Powell bfb41c6d84 * new targets: Generic_E22_*_repeater 2025-04-24 13:50:18 +10:00
Scott Powell 8c0c378821 * ESPNOW: packet rx/tx counters 2025-04-24 12:16:55 +10:00
Scott Powell 813ea4c5ec * ESPNOW: now using hardware RNG for radio_new_identity() 2025-04-24 10:59:01 +10:00
ripplebiz 53634baec7 Merge pull request #222 from rusty-labs/tbeam_sx1262_support
Support for TBeam SX1262 board /dev
2025-04-24 10:28:56 +10:00
rusty.labs 20dc022fe2 Support for TBeam SX1262 board 2025-04-23 20:23:06 -04:00
ripplebiz 733679d322 Merge pull request #205 from neutralinsomniac/add_default_nix
Add default.nix/.envrc for automagic dev environment on NixOS
2025-04-24 09:56:48 +10:00
ripplebiz eaa2dd583a Merge pull request #220 from fdlamotte/xiao-nrf52-targets
xiao_nrf52-missing_targets
2025-04-23 19:23:37 +10:00
Florent 7609f34290 xiao_nrf52-missing_targets 2025-04-23 11:20:28 +02:00
ripplebiz 40879c10de Merge pull request #219 from recrof/dev
bugfix: Faketec: only include SSD1306Display during build
2025-04-23 19:06:47 +10:00
recrof 2fe641407a bugfix: only include SSD1306Display during build 2025-04-23 10:43:56 +02:00
Scott Powell 264f51d510 * RP2040 IdentityStore begin(), to ensure mkdir() 2025-04-22 15:26:04 +10:00
ripplebiz 185149a645 Merge pull request #217 from AeroXuk/feature/rp2040_picow_dev
Support for Pi PicoW
2025-04-22 15:04:09 +10:00
AeroXuk c13190ff1b Hopefully the correct ADC_MULTIPLIER value. 2025-04-21 23:01:44 +01:00
AeroXuk eba02b1915 Correct opens to use "w" filemode instead of "w+" filemode. 2025-04-21 21:49:41 +01:00
AeroXuk b86be66239 Merge 'dev' into 'feature/rp2040_picow_dev'. 2025-04-21 21:21:10 +01:00
AeroXuk 6b34a94fb3 Added Pi PIcoW support in the following modes:
- Companion Radio over USB Serial
- Repeater
- Room Server
- Terminal Chat
2025-04-21 21:17:03 +01:00
Scott Powell 615686f5b1 Merge branch 'dev' 2025-04-21 21:57:55 +10:00
Scott Powell 1bdc1b4230 * ver bump to v1.5.1 2025-04-21 21:50:55 +10:00
Scott Powell b72906a340 * companion: bug fix for 'export contact' 2025-04-21 21:38:57 +10:00
Scott Powell decb479007 Merge branch 'dev' 2025-04-21 17:39:57 +10:00
Scott Powell eba5e64e49 * ver bump to v1.5.0 2025-04-21 17:39:36 +10:00
ripplebiz af5d3dc3d2 Merge pull request #211 from fdlamotte/techo-display
Techo display
2025-04-21 16:44:52 +10:00
Scott Powell 1d10a2b780 * fix for AutoDiscoverRTCClock 2025-04-21 16:35:55 +10:00
ripplebiz 843f2c4aca Merge pull request #212 from fdlamotte/xiao_nrf52-batread
xiao-nrf keep vbat_en to low to prevent issues ...
2025-04-21 16:29:26 +10:00
ripplebiz cc81d618f5 Merge pull request #210 from fdlamotte/xiao_expansion
support for xiao expansion board screen
2025-04-21 16:25:51 +10:00
ripplebiz 3347b54081 Merge pull request #208 from cod3doomy/dev
updated: t-beam supreme sx1262 to be merged
2025-04-21 16:23:06 +10:00
JQ 6c721a47fd adding connected check 2025-04-20 19:17:20 -07:00
Jacob Quatier 7065c1438e UI: battery indicator, boot screen, radio settings 2025-04-20 19:17:02 -07:00
Florent 5d83dfbbc9 xiao-nrf keep vbat_en to low to prevent issues ... 2025-04-20 21:15:59 +02:00
Florent eda4c5d397 std behaviour 2025-04-20 17:10:57 +02:00
Florent 4d4ab516f0 fix screen boot 2025-04-20 16:44:30 +02:00
Florent cd766d6795 led and button assigned in ui 2025-04-20 16:41:33 +02:00
Florent 5152f0455a support for xiao expansion board screen 2025-04-20 11:03:01 +02:00
cod3doomy e5a93877e6 t-beam s3 supreme: repeater, room server, and ble companion verified working. RTC working. No screen, GPS or sensors. 2025-04-19 19:51:01 -07:00
cod3doomy 44a1195314 Merge branch 'dev' of https://github.com/cod3doomy/MeshCore_HW_Dev into dev 2025-04-17 19:27:08 -07:00
Scott Powell c16db4d1a0 * room server keep_alive ACKs now have unsynced_count appended. 2025-04-17 15:46:51 +10:00
Jeremy O'Brien 5c040f17a4 add default.nix/.envrc for automagic platformio dev environment on NixOS 2025-04-16 12:18:49 -04:00
Scott Powell 430b5425c8 * room server login response now includes unsynced posts counter 2025-04-16 16:51:04 +10:00
Florent 8833fe78b0 techo-display: first bits 2025-04-15 22:37:50 +02:00
ripplebiz d401ab766f Merge pull request #193 from fdlamotte/t114-display
T114 display
2025-04-15 18:18:16 +10:00
Florent 00b2325353 Merge branch 'dev' into t114-display 2025-04-15 07:46:45 +02:00
Scott Powell 4011200f72 * fix: compilation error for T1000e 2025-04-15 15:15:06 +10:00
cod3doomy a4ef28b222 Merge branch 'dev' into dev 2025-04-14 20:43:33 -07:00
ripplebiz feb4b99716 Merge pull request #202 from fdlamotte/rx_boost_toggle_lr1110
permit access to rx_boosted_mode at runtime for LR1110
2025-04-15 12:03:02 +10:00
Florent ac206e3348 permit access to rx_boosted_mode at runtime for LR1110 (for dpm tests on that setting) 2025-04-14 12:23:28 +02:00
ripplebiz d76c7136c4 Merge pull request #192 from fdlamotte/prevent-errors-when-built-against-XiaoNrf52Board-by-error
compiles xiao_nrf52 board files only if we compile for xiao_nrf52
2025-04-13 13:39:53 +10:00
ripplebiz 1226bc9fe9 Merge pull request #196 from liamcottle/dev
Fix RAK4631 builds after addition of Xio nRF52 board
2025-04-13 13:22:58 +10:00
liamcottle 0345810412 fix rak4631 builds after addition of xio nrf52 board 2025-04-13 13:36:39 +12:00
Scott Powell 9eaf3d2b5d * companion: protocol ver (FIRMWARE_VER_CODE) now 4 2025-04-12 22:06:47 +10:00
Scott Powell 64b6703ae0 * new CMD_SET_OTHER_PARAMS (38) 2025-04-12 22:00:05 +10:00
Scott Powell 289cf71b8f Companion: new 'manual_add_contacts' pref. New PUSH_CODE_NEW_ADVERT frames 2025-04-12 21:43:30 +10:00
ripplebiz 45240a6795 Merge pull request #189 from fdlamotte/t1000_sensors_disable
t1000 : power bat sensor only when necessary
2025-04-12 13:32:01 +10:00
cod3doomy ca5390dbed T-Beam Supreme: Repeater and BLE working. Added PCF8563 RTC 2025-04-11 18:17:20 -07:00
Florent 8e04471f89 ui : manage colors and ensure fw using ssd1306 still compile 2025-04-11 22:23:47 +02:00
Florent 23000516a3 compiles xiao_nrf52 board files only if we compile for xiao_nrf52 2025-04-11 14:51:10 +02:00
ripplebiz 7eb939c5b8 Merge pull request #185 from fdlamotte/xiao-nrf52
Xiao nrf52
2025-04-11 20:32:44 +10:00
Scott Powell f6ad1b2118 minor refactor 2025-04-11 19:11:06 +10:00
Florent de Lamotte 2fd8a6e43e xiao-nrf52 : initial support for meshcore
initial config for xiao_nrf52

repeater role for xiao-nrf52

xiao-nrf52 correction on bat voltage

xiao-nrf52 this file should not be here ...
2025-04-11 08:10:18 +02:00
Scott Powell b85a154e43 Merge branch 'trans-codes' into dev 2025-04-11 15:12:14 +10:00
Scott Powell 122223a9aa * added Packet::getRawLength() helper 2025-04-11 15:12:04 +10:00
Scott Powell 38861c7053 * companion: onRawDataRecv() guard for payload_len too long 2025-04-11 14:12:09 +10:00
Florent a052a532ad t1000 : power bat sensor only when necessary 2025-04-10 22:00:25 +02:00
Scott Powell 20da4046b9 * Packet::header, new: ROUTE_TYPE_TRANS_FLOOD, ROUTE_TYPE_TRANS_DIRECT
* Packet wire format change: (optional) extra 4 bytes for two trans_codes
2025-04-11 04:56:13 +10:00
Florent de Lamotte 41af329c44 display and btn handling starts working ... 2025-04-10 16:24:17 +02:00
ripplebiz d559c897a4 Merge pull request #177 from fdlamotte/t114_usb
add companion radio usb to t114
2025-04-10 19:24:04 +10:00
ripplebiz 4f216e8de2 Merge pull request #188 from recrof/dev
lilygo t-echo: disable gps to conserve battery, move init stuff to variant.cpp; lilygo t-beam: report battery voltage
2025-04-10 17:09:16 +10:00
cod3doomy 30a45376af T-Beam Supreme: added PMU config, enabled pwr button. Repeater env verified working. 2025-04-09 18:28:46 -07:00
recrof 291fd1b0b3 LilyGo T-Beam: added battery voltage reporting 2025-04-09 14:08:13 +02:00
recrof 51970fcb72 move gps standby pin to gps section 2025-04-09 13:21:34 +02:00
recrof e699f77a48 lilygo t-echo: move init stuff to variant.cpp, disable gps to conserve battery 2025-04-09 13:18:35 +02:00
ripplebiz 1992840861 Merge pull request #187 from oltaco/rak-oled-pins
add defines for RAK OLED pins
2025-04-09 20:45:41 +10:00
ripplebiz 467925b5c5 Merge pull request #186 from oltaco/wire-setpins-buildfix
Wire.setpins buildfix
2025-04-09 19:55:20 +10:00
taco 384512668b build: fix RAK, T114, T1000 builds 2025-04-09 18:22:01 +10:00
taco 26611003d6 build: fix RAK, T114, T1000e builds 2025-04-09 18:19:13 +10:00
taco c1aff393de FIX: define OLED pins for RAK 2025-04-09 18:07:01 +10:00
ripplebiz b9c9c90f76 Merge pull request #184 from adrian-immel/Fix-Floating-Pin
Fix Floating Pin on FakeTec/Promicro: Update BUTTON_PIN to INPUT_PULLUP
2025-04-09 10:27:58 +10:00
cod3doomy 9a4aa4bdbf Checkpoint: Repeater env built and works with HW. No screen or other periphs 2025-04-08 17:08:28 -07:00
cod3doomy bd9ef578ac Initial commit with t-beam supreme sx1262 additions 2025-04-08 09:12:43 -07:00
Adrian 337e7932e3 Fix Floating Pin on Promicro
change INPUT to INPUT_PULLUP
2025-04-08 16:08:04 +02:00
ripplebiz 9b449a0a4b Merge pull request #183 from liamcottle/dev
Show version in build info for devices with a screen
2025-04-08 21:37:45 +10:00
liamcottle 54e26a6b42 remove unused variables 2025-04-08 23:17:22 +12:00
liamcottle 430aa0d19e show firmware version and build date on room server screen 2025-04-08 23:09:55 +12:00
liamcottle faa3a80f73 show firmware version and build date on repeater screen 2025-04-08 23:05:27 +12:00
liamcottle e213cc2765 show firmware version and build date on companion screen 2025-04-08 22:58:17 +12:00
ripplebiz 1b08aec38c Merge pull request #182 from oltaco/tbeam-8-group-channels
set TBeam MAX_GROUP_CHANNELS=8
2025-04-08 11:06:58 +10:00
taco bfd90e3e45 set TBeam MAX_GROUP_CHANNELS=8 2025-04-08 11:04:20 +10:00
Scott Powell ff6e2447b8 Merge branch 'dev' 2025-04-07 22:01:08 +10:00
Scott Powell 19797c9b87 * ver bump to v1.4.3 2025-04-07 21:59:53 +10:00
Scott Powell f80f5f090b * default SF now 11 2025-04-07 21:55:24 +10:00
Scott Powell 7d731e82f5 * ID hash 0x00 and 0xFF now reserved for future. 2025-04-06 12:34:09 +10:00
Florent 49288f161a add companion radio usb to t114 2025-04-05 17:28:25 +02:00
ripplebiz 98d29a7a2b Merge pull request #172 from recrof/dev
set repeater/room server Lat & Lon to 0.0 as default
2025-04-04 19:26:30 +11:00
ripplebiz 8fe566d95c Merge pull request #173 from oltaco/promicro-rfswitch
FIX: Set RfSwitch pins properly.
2025-04-04 19:25:12 +11:00
taco b4bc19a942 FIX: Need to explicitly setRfSwitchPins to drive RXEN high when in receive mode. 2025-04-04 15:39:11 +11:00
recrof e3f13a8285 set repeater/room server Lat & Lon to 0.0 as default 2025-04-03 14:59:20 +02:00
ripplebiz 86c4dbf222 Merge pull request #171 from LitBomb/patch-9
Update faq.md
2025-04-02 19:15:33 +11:00
uncle lit 5e3f6e9ca1 Update faq.md
Add table of content
Add http://config.meshcore.dev for repeater and room server setup
Add T-Deck GPS info screen sentences counter
Add explanation who 869.525MHz is the chosen frequency for EU and UK and why 867.5MHz isn't good comparing to 869.525
2025-04-01 22:49:09 -07:00
ripplebiz 47ee171147 Merge pull request #167 from fdlamotte/xiao_s3_serial_onpins
Allow the use companion radio on other serial interfaces
2025-04-02 00:02:46 +11:00
Florent de Lamotte a8241aabeb Merge branch 'dev' into xiao_s3_serial_onpins 2025-04-01 11:33:00 +02:00
Florent de Lamotte fcfc54d2b4 initial commit 2025-04-01 11:32:04 +02:00
ripplebiz a895e3a887 Merge pull request #165 from liamcottle/dev
Show please wait message on boot
2025-04-01 14:42:59 +11:00
liamcottle 6c34844486 init display before radio 2025-04-01 16:10:12 +13:00
liamcottle fb57b4d2d6 show please wait message on room server boot 2025-04-01 16:04:06 +13:00
liamcottle ddeb1421c5 show please wait message on repeater boot 2025-04-01 16:00:09 +13:00
liamcottle 196b225035 show please wait message on companion boot 2025-04-01 15:50:24 +13:00
ripplebiz 331c1d9cff Merge pull request #164 from liamcottle/dev
Fix Companion Display Noise
2025-04-01 13:02:57 +11:00
liamcottle afe3507ec5 clear display on init to avoid static 2025-04-01 14:46:48 +13:00
ripplebiz 48e4a4289f Merge pull request #155 from oltaco/promicro-refactor
ProMicro refactoring
2025-04-01 12:43:09 +11:00
ripplebiz 245b323076 Merge pull request #163 from LitBomb/patch-7
Update faq.md
2025-04-01 12:37:08 +11:00
uncle lit b66d5ebe15 Update faq.md
added the following to FAQ:

public/private flood and repeater set flood.max CLI
public key in hex and base64
How paths are created and reuse to minimize utilization
T-Deck Diag explanation
Update repeater with a Raspberry Pi
clients don't repeat explanation
other meshcore projects
fix discord link to build instruction
2025-03-31 14:51:52 -07:00
Scott Powell 0b95fc76ba * room server: faster sync of unread posts, MAX_UNSYNCED_POSTS now 32 (was 16) 2025-03-31 14:01:49 +11:00
ripplebiz 57862dec0f Merge pull request #149 from jameshall9327/main
TBeam: Added Repeater
2025-03-31 13:10:20 +11:00
Scott Powell afc64d8674 * Tbeam fix: GPIO assignments wrong 2025-03-31 13:03:33 +11:00
Scott Powell 017e567669 Merge commit '387a83e129114b6005321739149a1e0eb1fa5a82' into dev 2025-03-31 00:15:38 +11:00
ripplebiz 387a83e129 Merge pull request #157 from fdlamotte/t1000e_clock
Remove rtc auto-detect on t1000
2025-03-31 00:14:17 +11:00
Florent 90aaa41d84 Remove rtc auto-detect on t1000 2025-03-30 15:09:40 +02:00
Scott Powell 1c482b4315 Merge branch 'dev' 2025-03-30 19:18:35 +11:00
ripplebiz 5b986a36fc Merge pull request #145 from recrof/main
change new default freq to 869.525
2025-03-30 19:01:55 +11:00
Scott Powell e2ff6879dc * ver bump to v1.4.2 2025-03-30 18:56:21 +11:00
taco 2a236b0dc1 fix: give ProMicroLLCC68 a different definition 2025-03-30 15:57:20 +11:00
taco 68b3c75510 Refactor: FaketecBoard to PromicroBoard 2025-03-30 15:52:25 +11:00
Scott Powell 0d2d1e9c66 * minor refactor 2025-03-30 14:47:52 +11:00
ripplebiz d8d155ca5e Merge pull request #154 from recrof/dev
added new CommonCLI get commands: `get role` and `get public.key`
2025-03-30 14:40:49 +11:00
recrof f31e78069c added new CommonCLI get commands: get role and get public.key 2025-03-29 19:40:35 +01:00
Scott Powell dfca574481 * ESP-Now: long range mode 2025-03-29 13:27:17 +11:00
Scott Powell 01cf9d8535 * isReceiving() now includes either preamble detect or header detect 2025-03-28 22:20:42 +11:00
Scott Powell f1c2c96fb8 * Dispatcher: now impose a max time for CAD fail (ie. channel busy), defined by getCADFailMaxDuration(), default 4 seconds.
(an sx126x bug _might_ be making radio->isReceiving() return true indefinitely)
2025-03-28 20:50:42 +11:00
Scott Powell f615e9f5b7 * companion: temp fix: logRxRaw() is blowing the MAX_FRAME_SIZE 2025-03-28 14:14:59 +11:00
James Hall a3cd7fe761 TBeam: Added Repeater 2025-03-27 09:21:29 -04:00
Scott Powell 06684438b3 * refactor: rtc_clock now defined by variants/*/target modules 2025-03-27 21:28:06 +11:00
Scott Powell c8fa816dfc * new ESPNOWRadio driver
* refactored the examples/*/main.cpp modules, moving radio specifics to variants/*/target modules
* new Generic_ESPNOW_* target envs
2025-03-27 19:34:16 +11:00
Scott Powell b4b2ca2063 Merge branch 'dev' into esp-now 2025-03-27 17:24:56 +11:00
Scott Powell 882e5ba1c0 * room server: now support "log start/stop..." 2025-03-27 13:00:40 +11:00
recrof bf48fefd44 change new default freq to 869.525 2025-03-26 18:06:20 +01:00
ripplebiz 8f3d8da5db Merge pull request #144 from adrian-immel/Fix-Typo
Fix build issue for FakeTec board
2025-03-26 16:22:01 +11:00
Adrian ed69024cae Update FaketecBoard.cpp 2025-03-25 23:21:05 +01:00
Adrian 6fa77381d2 Rename faketecBoard.h to FaketecBoard.h 2025-03-25 23:16:08 +01:00
Adrian c6ff5ee850 Rename faketecBoard.cpp to FaketecBoard.cpp 2025-03-25 23:14:48 +01:00
Scott Powell 696dbded26 * experiment: enabling forwarding in terminal chat 2025-03-26 03:57:36 +11:00
Scott Powell c1c378b40c * ver bump to 1.4.1 2025-03-25 22:02:37 +11:00
Scott Powell 2424d026dc * flood_advert_interval" now defaults to 3 hours for upgrading nodes (not just fresh install)
* companion: "node_prefs" -> "new_prefs" migration
2025-03-25 20:20:03 +11:00
Scott Powell 83138bd39a * fix for double radio.begin(). RNG seed from pressing ENTER 2025-03-25 17:40:36 +11:00
Scott Powell e12d7bf699 * wifi power max 2025-03-25 15:13:07 +11:00
Scott Powell c97c27561a * more experiments 2025-03-25 01:26:46 +11:00
Scott Powell 7fff6dfe5c * ESP-NOW experiment with terminal-chat 2025-03-24 21:16:00 +11:00
Scott Powell 63845b0d5c * build fixes 2025-03-24 13:11:08 +11:00
ripplebiz 2722ee8f55 Merge pull request #128 from Noki/xiao-s3-wio-room-server
xiao s3 wio: add room server
2025-03-24 11:59:05 +11:00
ripplebiz e20c74b12a Merge pull request #127 from jameshall9327/main
Added screen and button support for the lilygo tbeam
2025-03-24 11:55:22 +11:00
ripplebiz 3768540b9b Merge pull request #135 from recrof/dev
LilyGo T-ECHO: report correct battery voltage
2025-03-24 11:48:52 +11:00
recrof 51a6ce0f62 cleanup 2025-03-23 18:31:39 +01:00
Rastislav Vysoky 0a73a96864 Merge branch 'ripplebiz:dev' into dev 2025-03-23 18:27:02 +01:00
recrof e921af46b7 LilyGo T-ECHO: report correct battery voltage 2025-03-23 15:57:33 +01:00
Scott Powell 783529325f * repeater & room server: "node_prefs" -> "com_prefs" migration 2025-03-24 00:50:28 +11:00
Scott Powell 83008d287b * room server: new config "allow.read.only" 2025-03-24 00:25:36 +11:00
Scott Powell e951143446 * repeater & room server: new config "flood.advert.interval" 2025-03-23 23:23:02 +11:00
Scott Powell 83c9dd6fa4 * companion: CMD_SEND_TXT_MSG fix for attempt number 2025-03-23 20:25:03 +11:00
Scott Powell a0ccea47c3 * refactor: ESP32 OTA lib-deps now selectively added 2025-03-23 17:36:31 +11:00
Scott Powell fe653b2836 * OTA update for ESP32 targets 2025-03-22 23:51:44 +11:00
Scott Powell 71af826344 * workaround for > 3 retry attempts 2025-03-22 22:21:54 +11:00
ripplebiz 0516c65709 Merge pull request #131 from fdlamotte/t1000e_range_fix
Some fixes for range issue
2025-03-22 11:54:10 +11:00
Florent de Lamotte 292349c7e0 Some fixes for range issue 2025-03-21 15:08:13 +01:00
Scott Powell 1320b4cea6 * faketec/promicro fix 2025-03-21 21:53:53 +11:00
Scott Powell 1b6ccc1c8d * fix for Faketec/Promicro 2025-03-21 21:53:23 +11:00
Scott Powell 41918efd6d * BIG refactor: 'board' and 'radio' objects now defined in 'target.h/.cpp'
* mesh::RTCClock class moved to MeshCore.h
2025-03-21 18:57:12 +11:00
Tobias Schwarz 7947d331d2 xiao s3 wio: add room server 2025-03-20 16:49:24 +00:00
James Hall 325569c526 added button support 2025-03-20 12:26:52 -04:00
James Hall b626dbca8a removed repeater code not working properly 2025-03-20 11:48:35 -04:00
James Hall a0633bdbb1 Screen support for tbeam 2025-03-20 11:44:12 -04:00
ripplebiz d068193481 Merge pull request #124 from recrof/dev
added battery voltage support for Heltec T114
2025-03-20 22:22:33 +11:00
recrof c5a69d4c72 added battery voltage support for Heltec T114 2025-03-20 11:08:13 +01:00
ripplebiz c18cde7ee2 Merge pull request #123 from oltaco/faketec-support
Faketec display and button support.
2025-03-20 15:27:25 +11:00
Scott Powell aabdabe232 * minor refactor, SNR from packet 2025-03-20 15:26:23 +11:00
taco 2bd3bc1a15 Fix builds for repeater, room server and companion usb. 2025-03-20 12:50:35 +11:00
taco b87f9b3b55 Remove PIN_OLED_RESET from board header, will leave in build target for now. 2025-03-20 10:05:01 +11:00
taco 5fcdbd357b Changed BLE pin back to 123456 now - dynamic display sensing happening. 2025-03-20 09:46:40 +11:00
taco 5d7deaffc9 Add faketec changes back after dev merge 2025-03-20 09:27:11 +11:00
taco 3bc9d094ac Merge branch 'dev' into faketec-support 2025-03-20 09:26:23 +11:00
Scott Powell 46cb2afb4f * build.sh: .uf2 step also for Faketec/ProMicro targets 2025-03-19 20:22:46 +11:00
Scott Powell 58852bcbd8 * ver bump to v1.4.0 2025-03-19 19:32:07 +11:00
Scott Powell 9c27e887ba * companion: CMD_SET_DEVICE_PIN now uint32 param, RESP_CODE_DEVICE_INFO now includes ble_pin 2025-03-19 18:21:35 +11:00
Scott Powell 3598836d19 * companion: added CMD_SET_DEVICE_PIN 2025-03-19 17:54:55 +11:00
Scott Powell debdfef299 * verify() fix moved to Identity class 2025-03-19 17:30:35 +11:00
Scott Powell d617e78558 * workaround for Identity::verify() bug. 2025-03-19 14:31:48 +11:00
Scott Powell 911fd2994a * experimental workaround for sig verify() bug 2025-03-19 13:54:43 +11:00
Scott Powell 331caffa98 * refactored platformio.ini, breaking up into variants/*.ini files 2025-03-18 23:57:04 +11:00
Scott Powell 797538bfae * TBeam: minor refactor. 2025-03-18 21:34:32 +11:00
ripplebiz ebfcf3abcc Merge pull request #100 from jameshall9327/main
Added Support for the LilyGo TBeam v1.1 and v1.2 with the SX1276
2025-03-18 21:29:38 +11:00
Scott Powell 9af1948674 * room server: now handles REQ_TYPE_GET_STATUS, replies with ServerStats (same as RepeaterStats, with extra fields: n_posted, n_post_push) 2025-03-18 16:49:40 +11:00
Scott Powell ad8c2e4a65 * companion: RESP_CODE_ERR now has err_code byte 2025-03-18 15:27:55 +11:00
ripplebiz b2c393ff58 Merge pull request #114 from lincomatic/pr-llcc68
Add ProMicroLLCC68 builds
2025-03-18 13:45:03 +11:00
Scott Powell 5b4ac86b06 * CMD_SEND_TRACE_PATH, now replies with RESP_CODE_SENT 2025-03-18 00:14:57 +11:00
Scott Powell cc9c9b4d57 * workaround for TRACE packets so they can follow a return path 2025-03-17 19:35:08 +11:00
Scott Powell c07dc51368 * companion support for TRACE packets. (CMD_SEND_TRACE_PATH, PUSH_CODE_TRACE_DATA) 2025-03-17 18:15:38 +11:00
Scott Powell 3aa7cf5652 * redesigned TRACE packet structure 2025-03-17 17:56:12 +11:00
taco d29ee95a49 match changes to other nrf52 boards, add pin definitions to platformio.ini 2025-03-17 13:51:26 +11:00
taco c20d3b7dda revert variant.h pins 2025-03-17 13:50:05 +11:00
taco 8825b74746 Merge branch 'faketec-testing' into dev 2025-03-17 13:15:54 +11:00
taco dc6a250133 move DISPLAY_CLASS definition 2025-03-17 13:09:26 +11:00
taco 356f0b762d define PIN_OLED_RESET -1 2025-03-17 13:09:02 +11:00
Scott Powell c7e1faca80 Merge branch 'dev' into trace
# Conflicts:
#	examples/companion_radio/main.cpp
2025-03-17 12:18:27 +11:00
taco 7c90cd3e38 tidy up 2025-03-17 12:17:36 +11:00
lincomatic 28fb5875b2 add ProMicroLLCC68 for Faketec w/ LLCC68 2025-03-16 17:48:52 -07:00
lincomatic a5ba20da35 fix compilation error 2025-03-16 16:49:55 -07:00
Scott Powell 6f79ddc025 * build fix 2025-03-16 22:11:27 +11:00
ripplebiz 34e16cb0d0 Merge pull request #111 from recrof/dev
added display support for RAK4631
2025-03-16 21:36:19 +11:00
recrof 304deff1c4 fixed: added back pin inits when SDA and SCL are set. 2025-03-16 10:17:04 +01:00
recrof 91405ac70a added display support for RAK4631, removed Wire.begin(int, int) from nrf52 devices, cosmetic changes 2025-03-16 09:07:21 +01:00
ripplebiz 35b13beb8e Merge pull request #107 from recrof/dev
heltec v2: added display, room server role
2025-03-16 19:04:38 +11:00
Rastislav Vysoky 9d46aa4307 Merge branch 'ripplebiz:dev' into dev 2025-03-16 07:11:53 +01:00
Scott Powell 968ccc47a3 * companion: SSD1306 display now dynamically detected at runtime. 2025-03-16 13:42:36 +11:00
taco 3c9a15fd14 OLED and button support, some refactoring. 2025-03-16 13:24:43 +11:00
James Hall 3c437fba6a Merge branch 'dev' into main 2025-03-15 15:10:17 -04:00
recrof 1f16b58822 heltec v2: added display, room server role 2025-03-15 20:10:07 +01:00
James Hall 787658dab7 Update TBeamBoard.h 2025-03-15 13:09:15 -04:00
James Hall 5b74d68a10 Merge branch 'ripplebiz:main' into main 2025-03-15 13:03:49 -04:00
ripplebiz 0edb67ae38 Merge pull request #105 from recrof/dev
added display support for t3s3
2025-03-15 23:44:09 +11:00
recrof a166613cc7 added display support for t3s3 2025-03-15 13:07:18 +01:00
Scott Powell 0e8fe7579b * CMD_SIGN_DATA null check 2025-03-15 22:06:57 +11:00
Scott Powell 0546edc51f * companion: can now sign arbitrary data (up to 8K) 2025-03-15 21:41:44 +11:00
Scott Powell a63a6ec6d4 Merge branch 'dev' into trace
# Conflicts:
#	examples/companion_radio/main.cpp
#	src/Dispatcher.cpp
2025-03-15 15:12:50 +11:00
Scott Powell 05e02babe6 * minor refactor for RAK_4631 SerialInterface 2025-03-15 14:55:52 +11:00
ripplebiz 46454ad7e3 Merge pull request #90 from oltaco/faketec-support
Faketec support
2025-03-15 14:47:18 +11:00
ripplebiz fd04cb818c Merge pull request #65 from awolden/awolden/h3-pin-fix
Fix heltec v3.2 pin polarity reversal
2025-03-15 12:09:47 +11:00
James Hall 935bc8a0de Cleaned up code 2025-03-14 19:54:46 -04:00
taco 7565014945 remove old unused board.json 2025-03-15 10:54:37 +11:00
James Hall 6d0d9b7d18 removed unnecessary defines 2025-03-14 14:27:10 -04:00
James Hall d247ec9c24 removed unnecessary constants 2025-03-14 14:22:13 -04:00
Scott Powell c00ee96d86 * some fixes around the powerOff(). Tidy ups 2025-03-14 19:08:41 +11:00
ripplebiz 54260688f0 Merge pull request #87 from fdlamotte/t1000e_ui
enhancement on the UI and support for power off and status_led
2025-03-14 18:52:00 +11:00
taco fc30e9eb2d MAX_GROUP_CHANNELS=8 for faketec 2025-03-14 15:24:58 +11:00
taco 21bec6c32b added conditional to room server radio bringup for supporting RA01sh radio on faketec 2025-03-14 15:22:42 +11:00
James Hall 8c7e4779a4 Delete .vscode/settings.json 2025-03-13 20:42:36 -04:00
James Hall 0e9ce66d2c removed pmu flag 2025-03-13 20:41:32 -04:00
James Hall 7a08f33604 Update settings.json 2025-03-13 20:35:44 -04:00
ripplebiz 7ffab96733 Merge pull request #94 from LitBomb/patch-5
Update faq.md for new EU and UK frequency, additional steps to setup repeater frequency
2025-03-14 11:29:34 +11:00
ripplebiz fef133124a Update README.md 2025-03-14 09:55:48 +11:00
James Hall c5dfb3d8c3 Added Support for the LilyGo TBeam v1.2 SX1276 2025-03-13 14:07:54 -04:00
fdlamotte b2c8b4dbc4 Merge branch 'ripplebiz:main' into t1000e_ui 2025-03-13 09:44:10 +01:00
taco bb05858bb6 added SX126X_RX_BOOSTED_GAIN=1 to faketec target 2025-03-13 17:46:58 +11:00
oltaco 84dbc284ad Merge branch 'ripplebiz:main' into faketec-support 2025-03-13 16:22:02 +11:00
Scott Powell c3a3309f5e * ver bump: 1.3.0 2025-03-13 13:46:01 +11:00
Scott Powell cc3c2ba958 * missing param 2025-03-13 13:32:46 +11:00
uncle lit 5ad461d033 Update faq.md
update UK and EU frequency to 869.525MHz per Andy and Recrof
add steps to set frequency on repeater after flash and before disconnecting USB cable
2025-03-12 10:45:07 -07:00
oltaco f01933f2c3 Merge branch 'ripplebiz:main' into faketec-support 2025-03-12 18:31:37 +11:00
fdlamotte c107a515d0 Merge branch 'ripplebiz:main' into t1000e_ui 2025-03-11 20:38:52 +01:00
Scott Powell 3dbe6bb11f Merge branch 'main' into dev 2025-03-11 20:09:59 +11:00
ripplebiz f94f63f5db Merge pull request #83 from fdlamotte/configure-cpu-frequency-at-build-time-for-esp32
Add an ESP32_CPU_FREQ build flag to lower freq
2025-03-11 20:06:28 +11:00
Florent de Lamotte 9bbe6626bc resolve conflict 2025-03-11 09:18:50 +01:00
Florent de Lamotte 9a8857b24e set cpu freq in ESP32Board.h 2025-03-11 09:11:14 +01:00
fdlamotte 47625da085 Merge branch 'ripplebiz:main' into configure-cpu-frequency-at-build-time-for-esp32 2025-03-11 09:01:45 +01:00
Scott Powell 60982b3821 * companion: channel names 2025-03-11 17:58:12 +11:00
taco 6db852f421 updated to MIT licensed board variant 2025-03-11 15:38:37 +11:00
Scott Powell c0379858b6 * companion: channels now persisted. RESP_CODE_DEVICE_INFO now includes MAX_CONTACTS (div 2) and MAX_GROUP_CHANNELS 2025-03-11 15:31:38 +11:00
Scott Powell 4863508e95 * Companion: new CMD_GET_CHANNEL, CMD_SET_CHANNEL 2025-03-11 14:50:40 +11:00
Scott Powell 6cb1be33d1 * BLE_NAME_PREFIX refactor 2025-03-11 13:25:48 +11:00
Scott Powell 8b586e1b66 Merge branch 'main' into dev 2025-03-11 13:20:52 +11:00
Scott Powell a38b0455f3 Merge branch 'main' into dev 2025-03-11 13:19:13 +11:00
ripplebiz f441697205 Merge pull request #74 from ddmunhoz/add-bool-meshcore-prefix
add: BLE_NAME_PREFIX flag
2025-03-11 13:02:54 +11:00
ripplebiz 31648b0fdb Merge pull request #85 from recrof/dev
Enabled sx1262 boosted RX gain for all supported radios + platformio.ini: Made quoted -D flags more readable
2025-03-11 12:54:44 +11:00
ripplebiz 782c4a5a69 Merge pull request #71 from fdlamotte/t1000e_txpower
tx_power can be raised to 22dBm on LR1110
2025-03-11 12:43:26 +11:00
ripplebiz e71237258c Merge pull request #88 from LitBomb/patch-4
Update faq.md
2025-03-11 12:40:30 +11:00
taco eebc4753c3 added conditional to radio bringup for RA01-SH support on faketec 2025-03-11 09:34:52 +11:00
taco 533f87e93b build fix to support RTC detection code 2025-03-11 09:34:52 +11:00
taco 319218b7ba Added logic to companion_radio firmware to hopefully fix the radio bringup for Faketec with RA01-SH. 2025-03-11 09:34:52 +11:00
taco 7fa0677fd3 Added defines for SX126X_RXEN, SX126X_TXEN.
Updated build target to enable privkey import/export.
2025-03-11 09:34:52 +11:00
taco aada976237 Faketec board support, including build targets 2025-03-11 09:34:52 +11:00
Florent d41b535ba8 better handling of BTN_USER_PRESSED definition 2025-03-10 22:42:52 +01:00
uncle lit 340d618258 Update faq.md
update Canada to use USA frequency
add guide to add nodes to map
add guide to do OTA firmware update for nRF devices
update donation links
general text cleanup
2025-03-10 11:52:39 -07:00
Florent de Lamotte afd52de03d enhancement on the UI and support for power off and status_led for t1000e 2025-03-10 18:11:15 +01:00
Scott Powell a88a3401c4 * repeater & room server: new CLI config "flood.max" 2025-03-10 23:28:19 +11:00
recrof 8f0fea86ca Merge branch 'dev' of github.com:recrof/MeshCore into dev 2025-03-09 23:07:36 +01:00
recrof 5e71294069 - Enabled sx1262 boosted RX gain for all supported radios
- Made quoted -D flags more readable
2025-03-09 22:57:31 +01:00
Florent 7e34f95f43 Add an ESP32_CPU_FREQ build flag to lower freq 2025-03-09 15:49:35 +01:00
ripplebiz 8a964b4bcb Merge pull request #81 from recrof/dev
roles: t-echo, t114: +room_server; WSL3: +room_server, +repeater
2025-03-10 00:22:33 +11:00
Scott Powell c5011e8b74 ver bump to 1.2.2 2025-03-09 23:46:03 +11:00
Scott Powell 2a8d42791f updating RadioLib to ver 7.1.2 2025-03-09 23:44:34 +11:00
Scott Powell 2df1820424 * trying setCRC(1) 2025-03-09 22:15:58 +11:00
Scott Powell 31aca85109 * repeater and room server: MESH_PACKET_LOGGING, now dumps RAW: rx packet contents
* Dispatcher: MESH_PACKET_LOGGING,  added " hash={packet-hash}"
2025-03-09 20:36:49 +11:00
Rastislav Vysoky aabd6ef396 Merge branch 'ripplebiz:dev' into dev 2025-03-09 07:16:50 +01:00
Scott Powell 82b53fb64d * PUSH_CODE_LOG_RX_DATA: is now just: {snr*4},{rssi},{raw-lora-packet} 2025-03-09 17:04:22 +11:00
Scott Powell 5b384a0122 * companion: added new PUSH_CODE_LOG_RX_DATA (0x88) for inspecting all received packets 2025-03-09 15:41:32 +11:00
Scott Powell bc4f4d0e66 Merge branch 'main' into dev
# Conflicts:
#	platformio.ini
2025-03-09 14:56:39 +11:00
ripplebiz ae2e9d9724 Merge pull request #78 from awolden/awolden/enable-SSD13060-lilygo-tlora
Enable SSD1306 display class for LilyGo_TLora_V2_1_1_6
2025-03-09 14:43:54 +11:00
Alex Wolden c32c4c0107 Fix heltec v3.2 pin polarity reversal 2025-03-08 11:21:19 -08:00
Scott Powell f7523c0eb3 * T1000e battery measure fix 2025-03-08 20:18:15 +11:00
Rastislav Vysoky b215e46196 Merge branch 'ripplebiz:dev' into dev 2025-03-08 10:05:27 +01:00
Scott Powell d8391a90ea * new build option: SX126X_RX_BOOSTED_GAIN 2025-03-08 19:59:07 +11:00
Scott Powell b6f9bd6a76 * Dispatcher: added guard for packet payload size too large 2025-03-08 19:38:36 +11:00
Rastislav Vysoky ad7289c88a added room server roles to t114 and t-echo; added repeater and room server roles to WSL3; unified json intendations in /boards 2025-03-08 09:15:51 +01:00
ripplebiz c09157c407 Merge pull request #70 from recrof/dev
added new board: Station G2; fix: added t114 and t-echo boards to uf2conv release workflow
2025-03-08 15:10:49 +11:00
Scott Powell 211fa85c19 * doc updates 2025-03-08 13:40:39 +11:00
Alex Wolden f38c17e98e Enable SSD1306 display class for LilyGo_TLora_V2_1_1_6 2025-03-07 14:30:11 -08:00
Diego Munhoz 09cb6935aa add: BLE_NAME_PREFIX flag 2025-03-07 11:41:53 -06:00
Rastislav Vysoky 89f068e662 Added basic support for Station G2 2025-03-07 15:34:00 +01:00
Florent de Lamotte 83e50fc5aa tx_power can be raised to 22dBm on LR1110 2025-03-07 13:52:47 +01:00
Rastislav Vysoky c108b842a0 Merge branch 'ripplebiz:dev' into dev 2025-03-07 13:42:56 +01:00
Rastislav Vysoky 8d7694383d fix: added t114 and t-echo boards to uf2conv release workflow 2025-03-07 13:17:46 +01:00
Scott Powell 39f286bdab Version bump to v1.2.1 2025-03-07 22:01:30 +11:00
Scott Powell e643722ef3 * Heltec v3.2 VEXT fix
* Heltec T114 LED fix, (now flashes with LoRa TX)
2025-03-07 21:37:05 +11:00
Scott Powell 04cc772a4f * display.begin() delayed in setup().
* all firmwares now bumped to v1.2.0
2025-03-07 17:19:27 +11:00
Scott Powell a1e89e524f * companion: better incoming ACK processing (match prev attempts) 2025-03-07 15:09:29 +11:00
Scott Powell c1f51e8996 * companion: FIRMWARE_VER_CODE now bumped to 3.
* companion: new RESP_CODE_CONTACT_MSG_RECV_V3, and _CHANNEL_MSG_RECV_V3. (now with packet SNR included)
2025-03-07 14:17:37 +11:00
Scott Powell ddded8a3e6 * refactor Packet::_snr to single byte 2025-03-07 12:32:23 +11:00
Scott Powell c762c4440d * TRACE packet logging fix 2025-03-07 12:24:18 +11:00
Scott Powell 8379a785cc Merge branch 'dev' into trace
# Conflicts:
#	src/Dispatcher.cpp
#	src/Mesh.cpp
#	src/helpers/BaseChatMesh.cpp
2025-03-07 12:14:26 +11:00
Scott Powell 4af80aa1d6 * companion: new command: CMD_GET_CONTACT_BY_KEY (30) 2025-03-07 12:00:11 +11:00
ripplebiz 21537d0085 Merge pull request #68 from recrof/dev
Added basic support for Heltec t114, LilyGo T-Echo
2025-03-07 10:22:34 +11:00
Rastislav Vysoky 0bc42c62a6 moved nrf sdk headers to ./lib/ and added Repeater envs for t114 & t-echo 2025-03-07 00:16:22 +01:00
Rastislav Vysoky dd0fe675a7 Added support for LilyGo T-Echo 2025-03-06 21:39:17 +01:00
Rastislav Vysoky ffb0ba36d9 fix: T114 reset pin value 2025-03-06 21:37:24 +01:00
Rastislav Vysoky 5a685bc829 Added support for Heltec t114 2025-03-06 20:43:56 +01:00
Scott Powell 4154632d63 * room server: version bump to v1.1.0. This is now NOT compatible with previous clients (TDeck and companion radio). 2025-03-06 18:36:43 +11:00
Scott Powell f4740815db * Room Server post ACK bug fix! 2025-03-06 18:16:48 +11:00
ripplebiz 89dde05929 Merge pull request #62 from awolden/awolden/t3lora
Add LILYGO T-LoRa V2.1-1.6 firmware
2025-03-06 16:33:27 +11:00
Alex Wolden 27ff6349dc Revert identity change 2025-03-05 19:38:08 -08:00
Scott Powell 4da58a8141 * .yml files, permissions: write 2025-03-05 19:48:52 +11:00
Scott Powell bbdf3eb2b9 * now suppressing 'cp' errors 2025-03-05 19:20:28 +11:00
Scott Powell f32a8093d4 * companion, HeltecV3: now picks random BLE pin for every session (from boot), unless a (non-zero) one stored in _prefs
* companion, WSL3: uses static BLE pin, per build BLE_PIN_CODE define
2025-03-05 19:14:34 +11:00
Alex Wolden 8d09e0f5c0 Merge remote-tracking branch 'origin/dev' into awolden/t3lora 2025-03-04 23:23:03 -08:00
Alex Wolden 22b3d7c435 Refactor naming 2025-03-04 22:00:48 -08:00
Scott Powell cb2211e1ca * repeater and room server: CommonCLI now handles load/save of Prefs. Now sanitise bad prefs values. 2025-03-05 16:39:45 +11:00
Scott Powell 2719e5195a * companion: UITask now shows BLE PIN (when no connection)
* companion, HeltecV3: new installs, now chooses random BLE PIN
* companion: prefs load/save improvements (sanitises bad values)
2025-03-05 15:47:29 +11:00
Alex Wolden 300844e4d4 add libsodium 2025-03-04 20:04:19 -08:00
Scott Powell ea6f0bfaa5 * basic UITask added to repeater and room server (only HeltecV3 targets enable so far) 2025-03-05 12:52:29 +11:00
Alex Wolden 7f8a529297 fix memory 2025-03-04 12:13:45 -08:00
Alex Wolden 652b70a36e readded 1262 radio 2025-03-04 09:03:36 -08:00
Scott Powell 6bc5946661 * new ui/DisplayDriver classes (just SSD1306Display impl for now)
* companion radio: now with optional UITask (enabled by DISPLAY_CLASS config in target/env)
2025-03-04 23:09:43 +11:00
Alex Wolden 9c2da990d2 Remove duplicate entries from platformio.ini
- Remove unnecessary T3S3 configurations
- Keep only the LilyGo T3 with SX1276 configurations
- Clean up the platformio.ini file to remove duplication
2025-03-04 00:16:35 -08:00
Alex Wolden 30e0047809 Add support for LilyGo T3 with SX1276 module
- Add custom partition table for fitting larger firmware
- Create LilyGoT3S3Board.h for board-specific functionality
- Update all example files to support the T3 board with SX1276
- Configure build environment for optimizing firmware size
- Set up the right pin configuration for SX1276 on LilyGo T3
2025-03-04 00:07:36 -08:00
Scott Powell 103fb04a7d * 'last_snr' added to repeater stats. 2025-03-04 18:29:16 +11:00
Scott Powell aa00004949 Merge branch 'main' into dev 2025-03-04 16:41:31 +11:00
Scott Powell bcb78e2c19 * build script change, for companion radio targets 2025-03-04 14:06:03 +11:00
Scott Powell 11179b6808 * SerialWifiInterface: misc tidy-ups 2025-03-04 14:04:47 +11:00
ripplebiz c47c33e07b Merge pull request #61 from fdlamotte/wifi-support
new Heltec_v3_companion_radio_wifi target
2025-03-04 13:54:23 +11:00
Florent de Lamotte 4aa925eada new Heltec_v3_companion_radio_wifi target 2025-03-03 13:26:37 +01:00
Scott Powell dba81f5b0c * misc 2025-03-03 19:51:45 +11:00
ripplebiz 75a8c8a7d9 Merge pull request #60 from liamcottle/feature/build-automation
Automated Firmware Builds and Releases
2025-03-03 19:51:07 +11:00
liamcottle 945553157c also build uf2 for t1000e 2025-03-03 21:13:55 +13:00
liamcottle 1ac71296d7 merge bins for esp32 boards 2025-03-03 18:51:27 +13:00
liamcottle ab0b2e3781 add release docs 2025-03-03 18:08:00 +13:00
liamcottle a4464b608d setup automated firmware builds with github actions 2025-03-03 17:58:15 +13:00
Scott Powell db5b44e546 * room server: adding post, was not sending Acks on retries.
* room server and repeater: now does NOT send Acks for TXT_TYPE_CLI_DATA commands
2025-03-03 15:30:50 +11:00
Scott Powell 5e463f6474 Merge branch 'dev' 2025-03-03 13:26:43 +11:00
Scott Powell e5b701a97b * Semantic versioning in repeater, room server. "ver" CLI command changed. 2025-03-03 13:22:49 +11:00
Scott Powell d26a201819 * HOTIFX: HeltecV3, SDA/SCL pin defines 2025-03-03 12:52:39 +11:00
Scott Powell fd882cbfd9 * companion: RESP_CODE_DEVICE_INFO format change. 2025-03-03 12:31:11 +11:00
ripplebiz e07ca873dc Merge pull request #58 from LitBomb/patch-1
Update faq.md
2025-03-03 11:55:56 +11:00
uncle lit 4d1b9e3893 Update faq.md
Add:
- definitions for BW, SF, CR
- Liam's meshcore web client and meshcore js
- what is 'import form clipboard' feature on t-deck

Update:
- Repeater and room server explanations
- phone client apps now support repeater and room server management over RF
2025-03-02 16:07:36 -08:00
Scott Powell 7f543df20c * new docs folder, FAQ added 2025-03-03 10:11:43 +11:00
Scott Powell 48ca4ab772 * companion radio: connection status now supported (Keep_alive pings, etc) 2025-03-02 20:15:13 +11:00
Scott Powell 19ad023fc5 * room server: login response, permission byte now returned 2025-03-02 14:19:19 +11:00
Scott Powell ee1fd75150 * companion radio: support for TXT_TYPE_SIGNED_PLAIN 2025-03-02 13:57:50 +11:00
Scott Powell bac3f1456e * prefs guard word added 2025-02-28 13:06:26 +11:00
Scott Powell 1058b5bca6 * misc 2025-02-28 12:50:14 +11:00
Scott Powell dfbc10f4ed * "set radio.." now with "OK" response 2025-02-28 12:49:36 +11:00
Scott Powell 9b887361d8 * CLI: get/set radio added 2025-02-28 12:24:45 +11:00
Scott Powell 7c063806d9 * repeater, room server: new prefs: sf, cr, bw. "set tx ..." now instant, no reboot needed. 2025-02-28 11:48:46 +11:00
ripplebiz 11ec8c535f Merge pull request #52 from liamcottle/board/t1000e
Add nRF52 S140 SoftDevice Header Files
2025-02-27 19:24:53 +11:00
Scott Powell a531537984 * CommonCLI: "get " commands 2025-02-27 18:02:47 +11:00
Scott Powell 3df3aac8ab * refactored handleCommand() to CommonCLI class 2025-02-27 17:00:44 +11:00
Scott Powell aab1326516 * various changes for CLI support via companion radio 2025-02-27 12:51:00 +11:00
Scott Powell 7c1c273255 * new Dispatcher::getCADFailRetryDelay() 2025-02-27 04:05:50 +11:00
liamcottle d39710160a add nrf52 s140 softdevice header files for compiling t1000e firmware 2025-02-27 02:35:12 +13:00
Scott Powell fcb213bf4d * ESP32: SerialBLEInterface, delay(500) not needed 2025-02-26 21:08:54 +11:00
Scott Powell 0d33e2e70a * esp32 SerialBLEInterface: 1 second delay now applied before testing whether to re-start advertising 2025-02-26 20:53:31 +11:00
ripplebiz 1d8057e232 Merge pull request #49 from liamcottle/main
Fix double pairing prompt for ESP32
2025-02-26 18:35:45 +11:00
liamcottle f072eb32b5 don't set encryption level on device as it's set on each characteristic 2025-02-26 20:24:14 +13:00
Scott Powell 6018775741 * build fixes for RAK targets 2025-02-26 18:19:38 +11:00
ripplebiz eb8089616b Merge pull request #47 from fdlamotte/t1000e_work
T1000e in tree ;)
2025-02-26 18:04:22 +11:00
ripplebiz 13b1d8c274 Merge pull request #48 from liamcottle/main
Fix BLE Pin for ESP32 and nRF52
2025-02-26 17:41:11 +11:00
liamcottle e232b1ce12 enforce pin being used for ble pairing on nrf52 2025-02-26 17:27:58 +13:00
liamcottle e6ca98f91e enforce pin being used for ble pairing on esp32 2025-02-26 17:04:44 +13:00
Florent de Lamotte f841d27d4d t1000e companion radio example builds in tree ! 2025-02-25 16:46:06 +01:00
Florent de Lamotte 6d38a1b502 upd t1000e board support 2025-02-25 14:02:19 +01:00
Scott Powell 9bb9e989fa * new helper: AutoDiscoverRTCClock, which detects: DS3231 (on i2c addr 0x68), or RV3028 (on i2c addr 0x52)
* repeater and room server: ver bump (v5), now use AutoDiscoverRTCClock
* various Board::begin() now should do Wire.begin(), with custom pin mappings if needed
* examples removed: ping client/server, and test_admin
2025-02-25 19:00:07 +11:00
Scott Powell b4b9705c7d * repeater and room server: login password now using strcmp(), new 'set direct.txdelay ..' config 2025-02-24 20:52:13 +11:00
Scott Powell 91bce664a5 * repeater: login now evicts oldest client table entry if full. New RESP_SERVER_LOGIN_OK login response format (with permissions byte)
* companion radio: PUSH_CODE_LOGIN_SUCCESS now returns 'permissions' byte (0 for legacy "OK" response)
2025-02-24 16:01:14 +11:00
Scott Powell 91d04dfdf1 * companion radio: new CMD_SEND_LOGIN, CMD_SEND_STATUS_REQ 2025-02-24 14:05:17 +11:00
Scott Powell 509964427a * new PAYLOAD_TYPE_RAW_CUSTOM 2025-02-23 15:35:33 +11:00
Scott Powell a896b9c5f7 * new StrHelper::strzcpy() 2025-02-22 20:10:31 +11:00
Scott Powell 395b026e6c * strncpy() refactor/fix 2025-02-22 19:41:24 +11:00
Scott Powell 4bf16344cd * added S3 WIO target for BLE companion radio 2025-02-22 10:44:45 +11:00
Scott Powell a8f2551c78 * tidy ups of PRIVATE_KEY_IMPORT/_EXPORT stuff 2025-02-21 13:51:26 +11:00
ripplebiz 2c7af7a643 Merge pull request #32 from liamcottle/main
add new commands to companion firmware to import and export identity
2025-02-21 13:29:39 +11:00
liamcottle 4027bef7b9 add build flags to enable and disable private key import and export 2025-02-21 14:54:59 +13:00
liamcottle 5cd282b15b add new commands to companion firmware to import and export identity private key 2025-02-21 12:34:15 +13:00
Scott Powell fa13ef1969 * room server: minor timing fix 2025-02-20 22:59:47 +11:00
Scott Powell 6af88ed02f * MESH_DEBUG_PRINTLN fixes 2025-02-20 18:04:35 +11:00
Scott Powell 159c4ce8c2 * Mesh/Dispatcher: MESH_DEBUG_ and MESH_PACKET_LOGGING now output date-time. (new getLogDateTime() virtual)
* MESH_PACKET_LOGGING now parity with dynamic/file logging (src/dest hashes)
2025-02-20 12:41:47 +11:00
Scott Powell c468459061 * companion radio: new CMD_DEVICE_QUERY -> RESP_CODE_DEVICE_INFO, airtime_factor added to CMD_SET_TUNING_PARAMS, CMD_REBOOT change 2025-02-19 18:59:43 +11:00
ripplebiz 706bc0cf48 Merge pull request #23 from fdlamotte/t1000e_code
T1000e code
2025-02-19 17:49:36 +11:00
Scott Powell e32003f8a3 * added RTCClock::getCurrentTimeUnique(), for when timestamps need to be unique (if temp rapid-fire) 2025-02-19 17:24:25 +11:00
Scott Powell 73c4ae748e * repeater: added src/dest hashes to logging 2025-02-18 23:49:25 +11:00
Scott Powell 01e8096e66 * SimpleMeshTables: ACKs now handled separately
* Dispatcher: logging methods now with 'len' param
2025-02-18 22:59:03 +11:00
Scott Powell 88ac6b6ee8 * repeater: Get Stats new fields added: n_direct_dups, n_flood_dups 2025-02-18 17:47:00 +11:00
Scott Powell 4cccaf6d47 * repeater: new CLI commands: "log start", "log stop", "log erase", and "log" 2025-02-18 13:20:48 +11:00
Scott Powell bea3ccb116 * new Packet type: PAYLOAD_TYPE_TRACE 2025-02-17 19:22:31 +11:00
Scott Powell ce20ec8f13 * repeater, room server and terminal chat: default to rxdelay off 2025-02-17 10:56:41 +11:00
Scott Powell 18b4e60bb0 * companion radio: "set af .." now applied, rxdelay now OFF by default. (can set though with new CMD_SET_TUNING_PARAMS) 2025-02-17 10:43:48 +11:00
ripplebiz f01daa2f78 Merge pull request #27 from liamcottle/main
added CMD_GET_BATTERY_VOLTAGE to companion radio
2025-02-16 14:56:54 +11:00
liamcottle 4a6f669aa3 added CMD_GET_BATTERY_VOLTAGE to companion radio 2025-02-16 16:51:10 +13:00
ripplebiz 5685bbd272 Merge pull request #26 from liamcottle/main
added CMD_REBOOT to companion radio
2025-02-16 13:50:34 +11:00
liamcottle 62703330ac added CMD_REBOOT to companion radio 2025-02-16 15:24:46 +13:00
Scott Powell e01ee62c72 * companion radio: new CMD_EXPORT_CONTACT, CMD_IMPORT_CONTACT 2025-02-15 15:57:02 +11:00
Scott Powell edf52ad4f3 * companion radio: new CMD_SHARE_CONTACT
* room server: push notify loop interval changed to 2 secs
2025-02-15 13:23:19 +11:00
Florent 9083d4db9b helper files for t1000e and LR1110 2025-02-14 09:54:06 +01:00
Florent 04553004af add T1000e conditionals to examples 2025-02-14 07:17:46 +01:00
Scott Powell 2081030449 * companion radio: BLE variants now set device name to "MeshCore-{advert-name}" 2025-02-14 10:46:40 +11:00
Scott Powell a06f5a8407 * ver bumps
* companion radio, USB: onSendTimeout() bug fix
2025-02-14 09:35:15 +11:00
Scott Powell 4048d1bd90 * BaseChatMesh: sendLogin(), onContactResponse()
* companion radio: contacts file, new 'sync_since' field
2025-02-14 07:52:43 +11:00
Scott Powell d350a7c341 * nrf52 BLE, increased MTU to 250 2025-02-13 20:22:56 +11:00
ripplebiz b9579718fa Merge pull request #20 from fdlamotte/nrf52_serial_ble
nrf52 ble uart should work with this ;)
2025-02-13 19:47:37 +11:00
Scott Powell bf8b9a61b9 * BaseChatMesh::sendGroupMessage() added
* companion radio, RESP_CODE_CHANNEL_MSG_RECV, CMD_SEND_CHANNEL_TXT_MSG
2025-02-13 10:18:48 +11:00
Florent de36c12362 nrf52 ble uart should work 2025-02-12 17:44:06 +01:00
Scott Powell fc075ecaa5 * companion radio for RAK (USB) now fixed. (thanks to Bernd Giesecke)
* experimental NRF52 impl of SerialBLEInterface, and experimental RAK BLE companion radio target
2025-02-12 18:40:00 +11:00
Scott Powell 2532210cdf * companion radio: _SELF_INFO frames now include current adv_lat, and adv_lon 2025-02-11 16:02:35 +11:00
Scott Powell 0ff94be3b3 * new target/envs: Heltec_v2_repeater, Heltec_v2_companion_radio_usb 2025-02-11 15:50:10 +11:00
Scott Powell fe9fa4766a * new target/env: Heltec_v2_terminal_chat 2025-02-11 12:36:26 +11:00
Scott Powell a2a8747be8 * companion radio: new command frames: CMD_SET_ADVERT_LATLON, CMD_REMOVE_CONTACT 2025-02-11 12:02:27 +11:00
Scott Powell 1762662419 Merge branch 'main' into rx_delay
# Conflicts:
#	examples/simple_repeater/main.cpp
#	examples/simple_room_server/main.cpp
2025-02-10 20:13:09 +11:00
Scott Powell 36a00175f4 * new "set guest.password .." CLI command 2025-02-10 16:36:14 +11:00
Scott Powell 8a952334e4 Merge branch 'main' into rx_delay 2025-02-10 11:08:42 +11:00
ripplebiz 2b71e9b3c2 Merge pull request #17 from Garrisonsan/patch-1
Update README.md regarding building for RAK devices
2025-02-10 11:06:23 +11:00
Garrisonsan bd42947f8b Update README.md
Added small section under RAK compatibility for info on how to convert hex to uf2, with link to Microsoft GitHub uf2conv python script. Cleaned up how links display in that section.
2025-02-09 16:24:04 -06:00
Scott Powell afd6889557 Merge branch 'main' into rx_delay
# Conflicts:
#	examples/companion_radio/main.cpp
#	examples/simple_secure_chat/main.cpp
2025-02-09 13:06:01 +11:00
Scott Powell 79399eb766 * companion radio: removed need for reboot after setting radio params or tx power 2025-02-09 09:58:56 +11:00
Scott Powell 5d62c1c247 * TIMEOUT estimate adjusted
* companion radio: new CMD_RESET_PATH
2025-02-08 20:57:35 +11:00
Scott Powell 759e50bd5d * repeater: min/max advert.interval changes 2025-02-08 19:57:10 +11:00
Scott Powell f5cd4333fd Merge branch 'main' into rx_delay
# Conflicts:
#	examples/simple_repeater/main.cpp
#	examples/simple_room_server/main.cpp
2025-02-08 12:04:17 +11:00
Scott Powell e05aa5da67 * repeater and room server: new CLI command: "set advert.interval {mins}" 2025-02-08 11:44:09 +11:00
Scott Powell 5a762aa511 Merge branch 'main' into rx_delay 2025-02-06 22:57:07 +11:00
Scott Powell 9699cf3ae4 * companion radio: new RESP_CODE_NO_MORE_MESSAGES response 2025-02-06 22:39:33 +11:00
Scott Powell e140649e4d * bug fix for rxdelay 0 2025-02-06 11:16:17 +11:00
Scott Powell aff21068b0 Merge branch 'main' into rx_delay 2025-02-06 10:54:52 +11:00
Scott Powell ff014ccf06 * RAK battery ADC multiplier tweak 2025-02-06 08:44:06 +11:00
Scott Powell 8b298d7c76 * companion radio: CMD_SET_RADIO_PARAMS fix 2025-02-05 22:04:25 +11:00
Scott Powell 9bc8494bf8 * new CLI command: "set txdelay ..." 2025-02-05 12:36:32 +11:00
Scott Powell af33db165f Merge branch 'main' into rx_delay 2025-02-05 12:09:27 +11:00
Scott Powell 523336b059 * companion radio: CMD_GET_DEVICE_TIME now responds with RESP_CODE_CURR_TIME(9) instead of RESP_CODE_OK 2025-02-05 11:13:39 +11:00
Scott Powell 73c4664a68 * companion radio bug fix 2025-02-05 10:42:40 +11:00
Scott Powell e83022c3fb * added companion radio targets for T3S3 board 2025-02-04 22:09:46 +11:00
Scott Powell d0f7e351aa Merge branch 'main' into rx_delay
# Conflicts:
#	examples/simple_repeater/main.cpp
#	examples/simple_room_server/main.cpp
2025-02-04 20:53:27 +11:00
Scott Powell f609f45fa1 * companion radio: offline messages queue 2025-02-04 19:40:30 +11:00
Scott Powell 2603c5272f * repeater and room server, new "set repeat {on|off}" CLI command 2025-02-04 18:27:13 +11:00
Scott Powell f10cdb0a3d Merge branch 'main' into rx_delay 2025-02-04 16:03:32 +11:00
Scott Powell 91ef5bbfa8 * Room server: added "start ota" CLI command 2025-02-04 16:03:17 +11:00
Scott Powell 04716c817c * new "set rxdelay ..." CLI command 2025-02-04 15:35:36 +11:00
Scott Powell c7a06d4f86 * new packet score function 2025-02-04 15:00:28 +11:00
Scott Powell 547cb0f734 * ver bumps
* RAK battery experiment
2025-02-04 13:40:54 +11:00
Scott Powell 63381dac25 * new RX delays based on SNR 2025-02-04 12:35:53 +11:00
Scott Powell 1369a3c127 * IdentityStore::save() was failing on RAK.
* Repeater: CLI 'erase' command added.
2025-02-04 01:35:04 +11:00
Scott Powell 6f087fb2b8 * companion radio: new CMD_SET_RADIO_TX_POWER frame, RESP_CODE_SELF_INFO responses now include tx_power_dbm and MAX_LORA_TX_POWER 2025-02-03 21:06:08 +11:00
Scott Powell d4eba69a74 * 'help' updated. 2025-02-03 14:21:19 +11:00
Scott Powell e25fb26ef3 * Terminal Chat: "set ..." commands, save to "node_prefs" file, consistent with the other firmwares 2025-02-03 13:56:57 +11:00
Scott Powell 12012a517f * refactor: new helpers/nrf52 dir
* RAK, startOTAUpdate()
2025-02-03 12:53:38 +11:00
Scott Powell db9f6d7ba0 * BUG FIX: Initial key generation 2025-02-02 11:03:23 +11:00
Scott Powell c2025820f2 * RAK batt read (hopefully) fixed 2025-02-02 09:44:59 +11:00
Scott Powell 60f0ff4642 * repeater and room server: added "set tx .." CLI command 2025-02-02 08:45:18 +11:00
Scott Powell 3a2eccbba1 * releasePacket() missing 2025-02-01 23:10:56 +11:00
Scott Powell 4a601f8241 * Terminal Chat: new commands "card" and "import" 2025-02-01 21:45:34 +11:00
Scott Powell 2cb55d3936 * Repeater: timing changes for self-advert 2025-02-01 19:06:39 +11:00
Scott Powell 0a6a8c40a7 * companion radio: RESP_CODE_END_OF_CONTACTS change 2025-02-01 17:04:26 +11:00
Scott Powell 59fc55208b * readme tweak 2025-02-01 14:31:19 +11:00
Scott Powell 08ef5f804c * companion radio CMD_SET_RADIO_PARAMS 2025-02-01 12:43:06 +11:00
Scott Powell 78e4f86b2a * added LLCC68 module support 2025-01-31 12:46:33 +11:00
Scott Powell 5a5efcbbfb * oops, default LORA_FREQ revert 2025-01-31 11:51:30 +11:00
Scott Powell 70279933fd * new target/envs: LilyGo_T3S3_sx1262, _repeater and _terminal_chat 2025-01-31 11:46:19 +11:00
Scott Powell 8044d92c40 * ver bump 2025-01-31 00:47:26 +11:00
Scott Powell 0177d4dbd4 * Room server: keep_alive changes 2025-01-31 00:02:29 +11:00
Scott Powell 55f7ed31f1 * Room server: no more "[posted]" replies from server 2025-01-30 20:09:00 +11:00
Scott Powell 959196de99 * new Packet::writeTo(), readFrom() methods. (for saving snapshots of packets) 2025-01-30 18:34:18 +11:00
ripplebiz 7ffaf710b5 Update README.md 2025-01-30 15:10:05 +11:00
Scott Powell 9af5adb861 * BaseChatMesh::sendMessage(), new est_timeout (OUT) param 2025-01-30 14:03:31 +11:00
Scott Powell f94d5f7423 * ver bumps 2025-01-30 13:46:04 +11:00
Scott Powell 659e66e3d1 * reset push_failures on successfully recv 2025-01-29 20:45:55 +11:00
Scott Powell 77a7656b99 * companion_radio: CMD_SEND_TXT_MSG format change 2025-01-29 14:06:46 +11:00
Scott Powell f46263a263 * ContactInfo, added gps_lat, gps_lon
* companion_radio: now also save gps_lat, gps_lon
* BaseChatMesh: now parses gps_lat, gps_lon out of Advertisement
2025-01-29 13:56:39 +11:00
Scott Powell 2e3d2d13b2 * room_server: login response now with a 'keep alive' interval suggestion
* room_server: new Request payload sub-type: REQ_TYPE_KEEP_ALIVE -> RESP_SERVER_KEEP_ALIVE
2025-01-29 13:14:42 +11:00
Scott Powell 4f0acbd8da * companion_radio_usb: encoding in ArduinoSerialInterface changed to 16-bit frame lengths
* MAX_FRAME_SIZE now 172 (to fit max 160 byte text msg)
2025-01-29 10:12:22 +11:00
Scott Powell e53f0d0725 * refactored BaseChatMesh::sendMessage(), added timestamp param 2025-01-29 02:11:46 +11:00
Scott Powell fe306a311e * new "contacts2" file format 2025-01-29 00:51:52 +11:00
Scott Powell dc11fe85cb * new env: RAK_4631_companion_radio_usb 2025-01-29 00:02:05 +11:00
Scott Powell cd81878e92 * added helpers/ArduinoSerialInterface, for the 'companion radio'
* .ini, target envs: Heltec_v3_companion_radio_usb &  Heltec_v3_companion_radio_ble
2025-01-28 23:26:55 +11:00
Scott Powell d9dc76f197 * new helper for ESP32: SerialBLEInterface
* Some refactoring in BaseChatMesh and Terminal Chat
* new companion_radio example
2025-01-28 20:30:15 +11:00
Scott Powell 52f9c358b7 * repeater: extra CLI commands
* room server: now loads/saves prefs, same CLI commands as repeater ("set ...")
2025-01-28 00:00:14 +11:00
Scott Powell 6fc21b815d * HeltecV3 targets, now flash built-in LED on LoRa TX 2025-01-27 12:53:34 +11:00
Scott Powell 37a6c230ad * new repeater CLI commands: "set af", "set name", "set lat", "set lon", "password" 2025-01-27 11:13:37 +11:00
Scott Powell 9a9b4fca82 * version bumps 2025-01-27 00:42:42 +11:00
Scott Powell 6c00653272 * TxtDataHelpers.h, with standard TXT sub-types
* Terminal chat: added "time <epoch-secs>"
* repeater: now recognises either TXT_TYPE_PLAIN or TXT_TYPE_CLI_DATA for CLI commands
* Room server: now uses TXT_TYPE_SIGNED_PLAIN (for push/outbound), recognises TXT_TYPE_PLAIN (to add a Post), and TXT_TYPE_CLI_DATA for CLI command
2025-01-26 22:56:38 +11:00
Scott Powell 40c3dfa20b * fixes for various targets (BaseChatMesh not compiling for non-terminal chat targets) 2025-01-26 15:40:32 +11:00
Scott Powell a3ce65c770 * new env: Xiao_S3_WIO_terminal_chat 2025-01-26 14:48:17 +11:00
Scott Powell 42af720b02 * fix for RAK terminal chat 2025-01-26 07:00:56 +11:00
Scott Powell 6d5e69ae04 * support for GroupChannels in BaseChatMesh, and terminal chat 2025-01-26 00:46:36 +11:00
Scott Powell e58d866949 * merge-bin.py script 2025-01-25 23:09:09 +11:00
Scott Powell 00a9e93754 * simple_secure_chat now with a proper CLI
* new: BaseChatMesh class, for abstract chat client
2025-01-25 22:03:25 +11:00
Scott Powell a3b7701bc0 * added 'ver' command to CLI (repeater and room server) 2025-01-24 22:00:13 +11:00
Scott Powell e78aa66d57 * Bug fix: hasName(), missing return :-(
* refactored methods to AdvertDataHelper.cpp
2025-01-24 19:45:45 +11:00
Scott Powell 068aeee87f * Refactor: new AdvertDataHelpers.h 2025-01-24 11:41:37 +11:00
Scott Powell 2d34ac58ee * room_server: crash fix, now detects timeouts on push post, if 3 timeouts on same client, then evicts/logs out 2025-01-23 21:24:23 +11:00
Scott Powell b8a5c3369f * NEW: simple_room_server 2025-01-23 16:07:44 +11:00
Scott Powell f5f978a398 * CAD detect fixed 2025-01-22 21:48:18 +11:00
Scott Powell 932d845922 * fix for duplicate msgId's in repeater CLI view 2025-01-22 20:53:43 +11:00
Scott Powell d69d2be722 * repeater: some refactors/clean ups, and (for ESP32) now using ESP32RTCClock which can keep time across a "reboot" command. 2025-01-22 19:47:53 +11:00
Scott Powell 22e87836db * Mesh.cpp: optimisation to not retransmit packets handled by this node
* simple_repeater: now supports a remote CLI
2025-01-22 12:11:43 +11:00
Scott Powell 6d10fab4f3 * commenting out CAD detect, for now 2025-01-21 22:35:20 +11:00
Scott Powell 47567b003f * new targets: RAK_4631_chat_alice, and _bob 2025-01-21 21:36:44 +11:00
Scott Powell 96724cd26a * onPeerPathRecv() refactored: 'reciprocal path' now handled in Mesh class, not in application layer 2025-01-21 18:39:55 +11:00
Scott Powell de27dfacb6 * basic CAD before TX, for sx126x wrappers 2025-01-21 13:37:32 +11:00
Scott Powell e838f405a7 * sx126x TX power boost for RAK target 2025-01-20 23:32:02 +11:00
Scott Powell c9579a7b7c * Notes for RAK support 2025-01-20 22:03:31 +11:00
Scott Powell 515285e3c9 * new target: RAK_4631_Repeater 2025-01-20 20:22:40 +11:00
Scott Powell eb685db693 * readme update 2025-01-20 10:30:52 +11:00
Scott Powell e4ec9aec0b * tidy ups 2025-01-20 10:20:42 +11:00
Scott Powell 919e6d380c * extra debug diagnostics for repeater 2025-01-19 20:22:02 +11:00
Scott Powell 88f21d9aa4 * new target env: Xiao S3 WIO repeater 2025-01-19 16:44:25 +11:00
Scott Powell 07ad40cac0 * repeater: build config: ADVERT_NAME, ADVERT_LAT, ADVERT_LON 2025-01-19 08:24:42 +11:00
Scott Powell 382b73f6c5 * Dispatcher: more stats added 2025-01-19 00:36:59 +11:00
Scott Powell 67b0dfa868 * configurable REPEATER_NAME 2025-01-18 22:52:34 +11:00
Scott Powell f1ab110ae1 * new targets: Xiao_C3_repeater_sx1262, _sx1268 2025-01-18 21:45:47 +11:00
Scott Powell 4bf7d7d58f * chat sample updated to auto-add Chat node advertisements 2025-01-17 02:12:58 +11:00
Scott Powell 9b09545379 * new advertisement app_data format 2025-01-16 22:26:01 +11:00
Scott Powell 86f11d08aa * LocalIdentity:: writeTo( array ) and readFrom (array ) 2025-01-16 01:59:11 +11:00
Scott Powell ec92bfa6b1 * Refactor: Mesh::onPeer ... methods added 'secret' param. (is whatever getPeerSharedSecret() returned) 2025-01-15 20:52:13 +11:00
Scott Powell cd92308c41 * simple_secure_chat: round trip time diagnostics, plus better timeout estimations 2025-01-15 18:47:25 +11:00
Scott Powell 57b7fc45b8 * simple_repeater CLI: basic commands (reboot, advert) 2025-01-15 17:14:08 +11:00
Scott Powell 20cd756c88 * Radio:: getLastSNR(), getLastRSSI()
* MESH_PACKET_LOGGING
2025-01-15 17:02:49 +11:00
Scott Powell cc5f21ab09 * more options for setting radio params via .ini file 2025-01-15 02:14:52 +11:00
Scott Powell daa157cf49 * minor fixes 2025-01-15 00:39:32 +11:00
Scott Powell a05b951018 * removed unused Destination class 2025-01-14 20:13:20 +11:00
Scott Powell c44f124616 * new 'flags' byte added to PAYLOAD_TYPE_TXT_MSG 2025-01-14 13:11:34 +11:00
Scott Powell 20fccac2b7 * refactored the hasSeen(Packet) stuff. 2025-01-14 06:43:03 +11:00
Scott Powell 8983584dd8 * added getTransmitDelay(), applied to Flood mode retransmissions. 2025-01-13 20:45:01 +11:00
Scott Powell d06532d6f1 * simple_secure_chat: bug fixes 2025-01-13 16:57:01 +11:00
Scott Powell d291c6d31e * zeroing of path_len now in sendFlood() 2025-01-13 15:09:03 +11:00
Scott Powell 2faff914f6 * separated PAYLOAD_TYPE_ANON_REQ, to new createAnonDatagram(), with extra 'sender' param. So, caller can use 'self_id' or ephemeral key 2025-01-13 15:01:15 +11:00
Scott Powell 6c7efdd0f6 Initial commit 2025-01-13 14:07:48 +11:00
387 changed files with 56223 additions and 39031 deletions

No files matched your search

+1
View File
@@ -0,0 +1 @@
use nix
@@ -0,0 +1,29 @@
name: Setup Build Environment
runs:
using: "composite"
steps:
- name: Init Cache
uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install PlatformIO
shell: bash
run: |
pip install --upgrade platformio
# a git tag of "room-server-v1.2.3" should set "v1.2.3" as GIT_TAG_VERSION
- name: Extract Version from Git Tag
shell: bash
run: |
GIT_TAG_NAME="${GITHUB_REF#refs/tags/}"
echo "GIT_TAG_VERSION=${GIT_TAG_NAME##*-}" >> $GITHUB_ENV
@@ -0,0 +1,42 @@
name: Build Companion Firmwares
permissions:
contents: write
on:
workflow_dispatch:
push:
tags:
- 'companion-*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone Repo
uses: actions/checkout@v4
- name: Setup Build Environment
uses: ./.github/actions/setup-build-environment
- name: Build Firmwares
env:
FIRMWARE_VERSION: ${{ env.GIT_TAG_VERSION }}
run: /usr/bin/env bash build.sh build-companion-firmwares
- name: Upload Workflow Artifacts
uses: actions/upload-artifact@v4
with:
name: companion-firmwares
path: out
- name: Create Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: Companion Firmware ${{ env.GIT_TAG_VERSION }}
body: ""
draft: true
files: out/*
@@ -0,0 +1,42 @@
name: Build Repeater Firmwares
permissions:
contents: write
on:
workflow_dispatch:
push:
tags:
- 'repeater-*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone Repo
uses: actions/checkout@v4
- name: Setup Build Environment
uses: ./.github/actions/setup-build-environment
- name: Build Firmwares
env:
FIRMWARE_VERSION: ${{ env.GIT_TAG_VERSION }}
run: /usr/bin/env bash build.sh build-repeater-firmwares
- name: Upload Workflow Artifacts
uses: actions/upload-artifact@v4
with:
name: repeater-firmwares
path: out
- name: Create Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: Repeater Firmware ${{ env.GIT_TAG_VERSION }}
body: ""
draft: true
files: out/*
@@ -0,0 +1,42 @@
name: Build Room Server Firmwares
permissions:
contents: write
on:
workflow_dispatch:
push:
tags:
- 'room-server-*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone Repo
uses: actions/checkout@v4
- name: Setup Build Environment
uses: ./.github/actions/setup-build-environment
- name: Build Firmwares
env:
FIRMWARE_VERSION: ${{ env.GIT_TAG_VERSION }}
run: /usr/bin/env bash build.sh build-room-server-firmwares
- name: Upload Workflow Artifacts
uses: actions/upload-artifact@v4
with:
name: room-server-firmwares
path: out
- name: Create Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: Room Server Firmware ${{ env.GIT_TAG_VERSION }}
body: ""
draft: true
files: out/*
+10
View File
@@ -0,0 +1,10 @@
.direnv
.pio
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json
.vscode/ipch
out/
.direnv/
.DS_Store
.vscode/settings.json
+10
View File
@@ -0,0 +1,10 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
-574
View File
@@ -1,574 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-terminal-4.8.0">
<meta name="description" content="MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults">
<link rel="icon" type="image/png" sizes="192x192" href="/meshcore-tth/img/android-chrome-192x192.png" />
<link rel="icon" type="image/png" sizes="512x512" href="/meshcore-tth/img/android-chrome-512x512.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/meshcore-tth/img/apple-touch-icon.png" />
<link rel="shortcut icon" type="image/png" sizes="48x48" href="/meshcore-tth/img/favicon.ico" />
<link rel="icon" type="image/png" sizes="16x16" href="/meshcore-tth/img/favicon-16x16.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/meshcore-tth/img/favicon-32x32.png" />
<title>404 - MeshCore TTH</title>
<link href="/meshcore-tth/css/fontawesome/css/fontawesome.min.css" rel="stylesheet">
<link href="/meshcore-tth/css/fontawesome/css/solid.min.css" rel="stylesheet">
<link href="/meshcore-tth/css/normalize.css" rel="stylesheet">
<link href="/meshcore-tth/css/terminal.css" rel="stylesheet">
<link href="/meshcore-tth/css/theme.css" rel="stylesheet">
<link href="/meshcore-tth/css/theme.tile_grid.css" rel="stylesheet">
<link href="/meshcore-tth/css/theme.footer.css" rel="stylesheet">
<!-- dark color palette -->
<link href="/meshcore-tth/css/palettes/dark.css" rel="stylesheet">
<!-- page layout -->
<style>
/* initially set page layout to a one column grid */
.terminal-mkdocs-main-grid {
display: grid;
grid-column-gap: 1.4em;
grid-template-columns: auto;
grid-template-rows: auto;
}
/*
* when side navigation is not hidden, use a two column grid.
* if the screen is too narrow, fall back to the initial one column grid layout.
* in this case the main content will be placed under the navigation panel.
*/
@media only screen and (min-width: 70em) {
.terminal-mkdocs-main-grid {
grid-template-columns: 4fr 9fr;
}
}</style>
<!-- cursor_animation override -->
<style>
#mkdocs-terminal-site-name.terminal-prompt::after {
display: none;
}
</style>
<link href="/meshcore-tth/_stylesheets/tth.css" rel="stylesheet">
<!-- search css support -->
<link href="/meshcore-tth/css/search/bootstrap-modal.css" rel="stylesheet">
<!-- search scripts -->
<script>
var base_url = "/meshcore-tth/",
shortcuts = "{}";
</script>
<script src="/meshcore-tth/js/jquery/jquery-1.10.1.min.js" defer></script>
<script src="/meshcore-tth/js/bootstrap/bootstrap.min.js" defer></script>
<script src="/meshcore-tth/js/mkdocs/base.js" defer></script>
<script src="/meshcore-tth/search/main.js"></script>
</head>
<body class="terminal"><div class="container">
<div class="terminal-nav">
<header class="terminal-logo">
<div id="mkdocs-terminal-site-name" class="logo terminal-prompt"><a href="https://tth-pub.pages.rfa.cz/meshcore-tth/" class="no-style">MeshCore TTH</a></div>
</header>
<nav class="terminal-menu">
<ul vocab="https://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
<a href="/meshcore-tth/." class="menu-item " property="item" typeof="WebPage">
<span property="name">About the fork</span>
</a>
<meta property="position" content="0">
</li>
<li property="itemListElement" typeof="ListItem">
<a href="/meshcore-tth/cs/" class="menu-item " property="item" typeof="WebPage">
<span property="name">Česky</span>
</a>
<meta property="position" content="1">
</li>
<li property="itemListElement" typeof="ListItem">
<a href="#" class="menu-item" data-toggle="modal" data-target="#mkdocs_search_modal" property="item" typeof="SearchAction">
<i aria-hidden="true" class="fa fa-search"></i> <span property="name">Search</span>
</a>
<meta property="position" content="2">
</li>
</ul>
</nav>
</div>
</div>
<div class="container">
<div class="terminal-mkdocs-main-grid"><aside id="terminal-mkdocs-side-panel"><nav>
<ul class="terminal-mkdocs-side-nav-items">
<li class="terminal-mkdocs-side-nav-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/.">About the fork</a>
</li>
<li class="terminal-mkdocs-side-nav-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/cs/">Česky</a>
</li>
<li class="terminal-mkdocs-side-nav-li">
<span class="
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">Fork meshcore-tth</span>
<ul class="terminal-mkdocs-side-nav-li-ul">
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/tth-commands/">Console commands</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/ota/">Firmware update by the admin (OTA)</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/power/">Power saving</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/budka-sensor/">Budka as a sensor</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/ble-lora-coexistence/">BLE/LoRa coexistence</a>
</li>
</ul>
</li>
<li class="terminal-mkdocs-side-nav-li">
<span class="
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">MeshCore (upstream)</span>
<ul class="terminal-mkdocs-side-nav-li-ul">
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/meshcore/">Introduction</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/faq/">FAQ</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/cli_commands/">CLI commands</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/companion_cli/">Companion CLI</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/companion_protocol/">Companion protocol</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/terminal_chat_cli/">Terminal chat CLI</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/kiss_modem_protocol/">KISS modem protocol</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/packet_format/">Packet format</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/payloads/">Payloads</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/stats_binary_frames/">Stats binary frames</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/number_allocations/">Number allocations</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/qr_codes/">QR codes</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/radio_presets/">Radio presets</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="/meshcore-tth/nrf52_power_management/">nRF52 power management</a>
</li>
</ul>
</li>
</ul>
</nav>
</aside>
<main id="terminal-mkdocs-main-content">
<br>
<div class="terminal-alert terminal-alert-error">The page you requested could not be found.</div>
<a href="https://tth-pub.pages.rfa.cz/meshcore-tth/"><button class="btn btn-default">Return Home</button></a>
</main>
</div>
<hr><footer>
<div class="terminal-mkdocs-footer-grid">
<div id="terminal-mkdocs-footer-copyright-info">
Site built with <a href="http://www.mkdocs.org">MkDocs</a> and <a href="https://github.com/ntno/mkdocs-terminal">Terminal for MkDocs</a>.
</div>
</div>
</footer>
</div>
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="alertdialog" aria-modal="true" aria-labelledby="searchModalLabel">
<div class="modal-dialog modal-lg" role="search">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="searchModalLabel">Search</h5>
<button type="button" class="close btn btn-default btn-ghost" data-dismiss="modal" aria-label="Close">x</button>
</div>
<div class="modal-body">
<p id="searchInputLabel">Type to start searching</p>
<form>
<div class="form-group">
<input type="search" class="form-control" aria-labelledby="searchInputLabel" placeholder="" id="mkdocs-search-query" title="Please enter search terms here">
</div>
</form>
<div id="mkdocs-search-results" data-no-results-text="No document matches found"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>
+111
View File
@@ -0,0 +1,111 @@
## About MeshCore
MeshCore is a lightweight, portable C++ library that enables multi-hop packet routing for embedded projects using LoRa and other packet radios. It is designed for developers who want to create resilient, decentralized communication networks that work without the internet.
## 🔍 What is MeshCore?
MeshCore now supports a range of LoRa devices, allowing for easy flashing without the need to compile firmware manually. Users can flash a pre-built binary using tools like Adafruit ESPTool and interact with the network through a serial console.
MeshCore provides the ability to create wireless mesh networks, similar to Meshtastic and Reticulum but with a focus on lightweight multi-hop packet routing for embedded projects. Unlike Meshtastic, which is tailored for casual LoRa communication, or Reticulum, which offers advanced networking, MeshCore balances simplicity with scalability, making it ideal for custom embedded solutions., where devices (nodes) can communicate over long distances by relaying messages through intermediate nodes. This is especially useful in off-grid, emergency, or tactical situations where traditional communication infrastructure is unavailable.
## ⚡ Key Features
* Multi-Hop Packet Routing – Devices can forward messages across multiple nodes, extending range beyond a single radio's reach. MeshCore supports up to a configurable number of hops to balance network efficiency and prevent excessive traffic.
* Supports LoRa Radios – Works with Heltec, RAK Wireless, and other LoRa-based hardware.
* Decentralized & Resilient – No central server or internet required; the network is self-healing.
* Low Power Consumption – Ideal for battery-powered or solar-powered devices.
* Simple to Deploy – Pre-built example applications make it easy to get started.
## 🎯 What Can You Use MeshCore For?
* Off-Grid Communication: Stay connected even in remote areas.
* Emergency Response & Disaster Recovery: Set up instant networks where infrastructure is down.
* Outdoor Activities: Hiking, camping, and adventure racing communication.
* Tactical & Security Applications: Military, law enforcement, and private security use cases.
* IoT & Sensor Networks: Collect data from remote sensors and relay it back to a central location.
## 🚀 How to Get Started
- Watch the [MeshCore Intro Video](https://www.youtube.com/watch?v=t1qne8uJBAc) by Andy Kirby.
- Read through our [Frequently Asked Questions](./docs/faq.md) section.
- Flash the MeshCore firmware on a supported device.
- Connect with a supported client.
For developers;
- Install [PlatformIO](https://docs.platformio.org) in [Visual Studio Code](https://code.visualstudio.com).
- Clone and open the MeshCore repository in Visual Studio Code.
- See the example applications you can modify and run:
- [Companion Radio](./examples/companion_radio) - For use with an external chat app, over BLE, USB or WiFi.
- [Simple Repeater](./examples/simple_repeater) - Extends network coverage by relaying messages.
- [Simple Room Server](./examples/simple_room_server) - A simple BBS server for shared Posts.
- [Simple Secure Chat](./examples/simple_secure_chat) - Secure terminal based text communication between devices.
The Simple Secure Chat example can be interacted with through the Serial Monitor in Visual Studio Code, or with a Serial USB Terminal on Android.
## ⚡️ MeshCore Flasher
We have prebuilt firmware ready to flash on supported devices.
- Launch https://flasher.meshcore.co.uk
- Select a supported device
- Flash one of the firmware types:
- Companion, Repeater or Room Server
- Once flashing is complete, you can connect with one of the MeshCore clients below.
## 📱 MeshCore Clients
**Companion Firmware**
The companion firmware can be connected to via BLE, USB or WiFi depending on the firmware type you flashed.
- Web: https://app.meshcore.nz
- Android: https://play.google.com/store/apps/details?id=com.liamcottle.meshcore.android
- iOS: https://apps.apple.com/us/app/meshcore/id6742354151?platform=iphone
- NodeJS: https://github.com/liamcottle/meshcore.js
- Python: https://github.com/fdlamotte/meshcore-cli
**Repeater and Room Server Firmware**
The repeater and room server firmwares can be setup via USB in the web config tool.
- https://config.meshcore.dev
They can also be managed via LoRa in the mobile app by using the Remote Management feature.
## 🛠 Hardware Compatibility
MeshCore is designed for use with:
* Heltec V3 LoRa Boards
* RAK4631
* XiaoS3 WIO (sx1262 combo)
* XiaoC3 (plus external sx126x module)
* LilyGo T3S3
* Heltec T114
* Station G2
* Sensecap T1000e
* Heltec V2
* LilyGo TLora32 v1.6
## 📜 License
MeshCore is open-source software released under the MIT License. You are free to use, modify, and distribute it for personal and commercial projects.
## Contributing
Please submit PR's using 'dev' as the base branch!
For minor changes just submit your PR and I'll try to review it, but for anything more 'impactful' please open an Issue first and start a discussion. Is better to sound out what it is you want to achieve first, and try to come to a consensus on what the best approach is, especially when it impacts the structure or architecture of this codebase.
## 📞 Get Support
- Report bugs and request features on the [GitHub Issues](https://github.com/ripplebiz/MeshCore/issues) page.
- Find additional guides and components on [my site](https://buymeacoffee.com/ripplebiz).
- Join [Andy Kirby's Discord](https://discord.gg/GBxVx2JMAy) to chat with the developers and get help from the community.
## RAK Wireless Board Support in PlatformIO
Before building/flashing the RAK4631 targets in this project, there is, unfortunately, some patching you have to do to your platformIO packages to make it work. There is a guide here on the process:
[RAK Wireless: How to Perform Installation of Board Support Package in PlatformIO](https://learn.rakwireless.com/hc/en-us/articles/26687276346775-How-To-Perform-Installation-of-Board-Support-Package-in-PlatformIO)
After building, you will need to convert the output firmware.hex file into a .uf2 file you can copy over to your RAK4631 device (after doing a full erase) by using the command `uf2conv.py -f 0xADA52840 -c firmware.hex` with the python script available from:
[GitHub: Microsoft - uf2](https://github.com/Microsoft/uf2/blob/master/utils/uf2conv.py)
+15
View File
@@ -0,0 +1,15 @@
# Releasing Firmware
GitHub Actions is set up to automatically build and release firmware.
It will automatically build firmware when one of the following tag formats are pushed.
- `companion-v1.0.0`
- `repeater-v1.0.0`
- `room-server-v1.0.0`
> NOTE: replace `v1.0.0` with the version you want to release as.
- You can push one, or more tags on the same commit, and they will all build separately.
- Once the firmware has been built, a new (draft) GitHub Release will be created.
- You will need to update the release notes, and publish it.
-12
View File
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 134 15" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<path d="M3.277,0.053C2.829,0.053 2.401,0.41 2.321,0.851L0.013,13.623C-0.067,14.064 0.232,14.421 0.681,14.421L3.13,14.421C3.578,14.421 4.006,14.064 4.086,13.623L5.004,8.54L6.684,13.957C6.766,14.239 7.02,14.421 7.337,14.421L10.58,14.421C10.897,14.421 11.217,14.239 11.401,13.957L15.043,8.513L14.119,13.623C14.038,14.064 14.338,14.421 14.787,14.421L17.236,14.421C17.684,14.421 18.112,14.064 18.192,13.623L20.5,0.851C20.582,0.41 20.283,0.053 19.834,0.053L16.69,0.053C16.373,0.053 16.053,0.235 15.87,0.517L9.897,9.473C9.803,9.616 9.578,9.578 9.528,9.41L7.074,0.517C6.992,0.235 6.738,0.053 6.421,0.053L3.277,0.053Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M21.146,14.421C21.146,14.421 33.257,14.421 33.257,14.421C33.526,14.421 33.784,14.205 33.831,13.942L34.337,11.128C34.385,10.863 34.206,10.649 33.936,10.649L25.519,10.649C25.429,10.649 25.37,10.576 25.385,10.488L25.635,9.105C25.65,9.017 25.736,8.944 25.826,8.944L32.596,8.944C32.865,8.944 33.123,8.728 33.171,8.465L33.621,5.974C33.669,5.709 33.49,5.495 33.221,5.495L26.45,5.495C26.361,5.495 26.301,5.423 26.317,5.335L26.584,3.852C26.599,3.764 26.685,3.691 26.775,3.691L35.192,3.691C35.462,3.691 35.719,3.476 35.767,3.21L36.258,0.498C36.306,0.235 36.126,0.019 35.857,0.019L23.746,0.019C23.297,0.019 22.867,0.378 22.788,0.819L20.474,13.621C20.396,14.062 20.695,14.421 21.146,14.421Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M45.926,14.419L45.926,14.421L46.346,14.421C48.453,14.421 50.465,12.742 50.839,10.67L51.081,9.327C51.456,7.256 50.05,5.576 47.943,5.576L41.455,5.576C41.186,5.576 41.007,5.363 41.054,5.097L41.218,4.192C41.266,3.927 41.524,3.713 41.793,3.713L50.569,3.713C51.018,3.713 51.446,3.356 51.526,2.915L51.9,0.85C51.98,0.407 51.68,0.05 51.232,0.05L41.638,0.05C39.531,0.05 37.519,1.73 37.145,3.801L36.88,5.267C36.505,7.339 37.91,9.018 40.018,9.018L46.506,9.018C46.775,9.018 46.954,9.231 46.907,9.497L46.785,10.176C46.737,10.441 46.479,10.655 46.21,10.655L37.189,10.655C36.741,10.655 36.313,11.012 36.233,11.453L35.841,13.621C35.761,14.062 36.061,14.419 36.51,14.419L45.926,14.419Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M68.008,0.046C68.008,0.046 65.296,0.046 65.296,0.046C64.847,0.046 64.42,0.403 64.34,0.844L63.532,5.31C63.517,5.398 63.431,5.469 63.341,5.469L58.085,5.469C57.995,5.469 57.936,5.398 57.951,5.31L58.758,0.844C58.837,0.403 58.539,0.046 58.09,0.046L55.378,0.046C54.93,0.046 54.502,0.403 54.422,0.844L52.112,13.623C52.032,14.064 52.331,14.421 52.78,14.421L55.492,14.421C55.941,14.421 56.369,14.064 56.449,13.623L57.272,9.074C57.287,8.986 57.373,8.914 57.462,8.914L62.719,8.914C62.809,8.914 62.868,8.985 62.853,9.074L62.032,13.623C61.952,14.064 62.252,14.421 62.7,14.421L65.413,14.421C65.861,14.421 66.289,14.064 66.369,13.623L68.678,0.844C68.755,0.403 68.457,0.046 68.008,0.046Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M72.099,14.421C72.099,14.421 80.066,14.421 80.066,14.421C80.515,14.421 80.943,14.064 81.022,13.623L81.414,11.453C81.494,11.012 81.194,10.655 80.746,10.655L73.828,10.655C73.559,10.655 73.38,10.441 73.427,10.176L74.51,4.215C74.558,3.951 74.815,3.736 75.082,3.736L82,3.736C82.448,3.736 82.876,3.379 82.956,2.938L83.34,0.817C83.42,0.376 83.12,0.019 82.672,0.019L74.724,0.019C72.622,0.019 70.614,1.691 70.236,3.757L68.965,10.665C68.587,12.738 69.99,14.421 72.099,14.421Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M97.176,-0C97.176,0 88.882,0 88.882,0C86.775,0 84.763,1.68 84.389,3.751L83.139,10.67C82.765,12.741 84.169,14.421 86.277,14.421L94.571,14.421C96.678,14.421 98.69,12.741 99.064,10.67L100.314,3.751C100.689,1.68 99.284,-0 97.176,-0ZM94.798,10.178C94.75,10.443 94.492,10.657 94.223,10.657L87.978,10.657C87.709,10.657 87.529,10.443 87.577,10.178L88.659,4.192C88.707,3.927 88.964,3.713 89.234,3.713L95.477,3.713C95.747,3.713 95.926,3.927 95.878,4.192L94.798,10.178Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M101.284,14.421L103.995,14.421C104.443,14.421 104.871,14.065 104.951,13.624L105.43,10.97C105.446,10.882 105.531,10.81 105.621,10.81L108.902,10.806C109.064,10.806 109.2,10.886 109.267,11.018L110.813,14.035C110.992,14.392 111.319,14.434 112.303,14.419C112.88,14.426 113.756,14.382 115.169,14.382C115.623,14.382 115.902,13.907 115.678,13.51L113.989,10.569C113.945,10.491 113.993,10.386 114.086,10.34C115.39,9.707 116.423,8.477 116.681,7.055L117.27,3.785C117.646,1.713 116.242,0.033 114.134,0.033L103.884,0.033C103.436,0.033 103.008,0.39 102.928,0.831L100.616,13.623C100.536,14.064 100.836,14.421 101.284,14.421L101.284,14.421ZM106.73,3.791C106.745,3.703 106.831,3.631 106.921,3.631L112.225,3.631C112.626,3.631 112.891,3.949 112.821,4.343L112.431,6.494C112.359,6.885 111.979,7.204 111.58,7.204L106.276,7.204C106.186,7.204 106.127,7.133 106.142,7.043L106.73,3.791Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M118.277,14.421C118.277,14.421 130.388,14.421 130.388,14.421C130.657,14.421 130.915,14.205 130.963,13.942L131.468,11.128C131.516,10.863 131.337,10.649 131.068,10.649L122.65,10.649C122.56,10.649 122.501,10.576 122.516,10.488L122.766,9.105C122.781,9.017 122.867,8.944 122.957,8.944L129.728,8.944C129.997,8.944 130.254,8.728 130.302,8.465L130.753,5.974C130.801,5.709 130.621,5.495 130.352,5.495L123.581,5.495C123.492,5.495 123.432,5.423 123.448,5.335L123.715,3.852C123.73,3.764 123.816,3.691 123.906,3.691L132.324,3.691C132.593,3.691 132.851,3.476 132.898,3.21L133.389,0.498C133.437,0.235 133.257,0.019 132.988,0.019L120.877,0.019C120.428,0.019 119.999,0.378 119.919,0.819L117.605,13.621C117.527,14.062 117.827,14.421 118.277,14.421Z" style="fill:white;fill-rule:nonzero;"/>
</svg>

Before

Width:  |  Height:  |  Size: 5.9 KiB

-14
View File
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%" viewBox="0 0 139 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<path d="M3.232,3.582C2.789,3.582 2.368,3.934 2.289,4.369L0.013,16.964C-0.066,17.399 0.229,17.751 0.671,17.751L3.087,17.751C3.529,17.751 3.951,17.399 4.03,16.964L4.935,11.951L6.592,17.293C6.672,17.572 6.923,17.751 7.235,17.751L10.434,17.751C10.746,17.751 11.062,17.572 11.243,17.293L14.835,11.925L13.924,16.964C13.844,17.399 14.14,17.751 14.583,17.751L16.998,17.751C17.44,17.751 17.862,17.399 17.941,16.964L20.217,4.369C20.298,3.934 20.002,3.582 19.56,3.582L16.46,3.582C16.147,3.582 15.831,3.761 15.65,4.04L9.76,12.872C9.668,13.013 9.446,12.975 9.397,12.81L6.976,4.04C6.895,3.761 6.645,3.582 6.332,3.582L3.232,3.582Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M20.853,17.751C20.853,17.751 32.797,17.751 32.797,17.751C33.063,17.751 33.317,17.538 33.364,17.278L33.863,14.504C33.91,14.242 33.733,14.031 33.467,14.031L25.166,14.031C25.077,14.031 25.019,13.96 25.034,13.873L25.281,12.508C25.296,12.421 25.38,12.35 25.469,12.35L32.146,12.35C32.411,12.35 32.665,12.137 32.712,11.877L33.157,9.421C33.204,9.159 33.027,8.949 32.761,8.949L26.085,8.949C25.996,8.949 25.938,8.877 25.953,8.79L26.216,7.328C26.232,7.241 26.316,7.17 26.405,7.17L34.706,7.17C34.971,7.17 35.226,6.957 35.272,6.695L35.756,4.021C35.804,3.761 35.627,3.548 35.361,3.548L23.417,3.548C22.975,3.548 22.551,3.902 22.473,4.337L20.191,16.962C20.114,17.397 20.409,17.751 20.853,17.751Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M45.291,17.749L45.291,17.751L45.705,17.751C47.783,17.751 49.767,16.095 50.136,14.052L50.375,12.727C50.744,10.685 49.359,9.029 47.28,9.029L40.882,9.029C40.617,9.029 40.44,8.818 40.487,8.556L40.649,7.664C40.696,7.402 40.95,7.191 41.215,7.191L49.87,7.191C50.313,7.191 50.735,6.839 50.814,6.404L51.183,4.368C51.262,3.931 50.966,3.579 50.523,3.579L41.063,3.579C38.985,3.579 37,5.235 36.631,7.278L36.37,8.723C36.001,10.767 37.386,12.422 39.465,12.422L45.863,12.422C46.128,12.422 46.305,12.633 46.258,12.895L46.138,13.565C46.091,13.826 45.837,14.037 45.571,14.037L36.675,14.037C36.233,14.037 35.811,14.389 35.732,14.824L35.346,16.962C35.267,17.397 35.562,17.749 36.005,17.749L45.291,17.749Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M67.068,3.575C67.068,3.575 64.393,3.575 64.393,3.575C63.951,3.575 63.529,3.927 63.45,4.361L62.654,8.766C62.639,8.853 62.554,8.923 62.466,8.923L57.282,8.923C57.193,8.923 57.135,8.853 57.15,8.766L57.946,4.361C58.023,3.927 57.73,3.575 57.287,3.575L54.613,3.575C54.17,3.575 53.748,3.927 53.669,4.361L51.392,16.964C51.313,17.399 51.608,17.751 52.05,17.751L54.725,17.751C55.168,17.751 55.589,17.399 55.668,16.964L56.48,12.478C56.495,12.392 56.58,12.32 56.668,12.32L61.852,12.32C61.941,12.32 61.999,12.39 61.984,12.478L61.174,16.964C61.096,17.399 61.391,17.751 61.834,17.751L64.508,17.751C64.951,17.751 65.372,17.399 65.451,16.964L67.729,4.361C67.804,3.927 67.511,3.575 67.068,3.575Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M71.102,17.751C71.102,17.751 78.96,17.751 78.96,17.751C79.402,17.751 79.824,17.399 79.903,16.964L80.288,14.824C80.367,14.389 80.072,14.037 79.629,14.037L72.808,14.037C72.542,14.037 72.365,13.826 72.412,13.565L73.48,7.686C73.527,7.426 73.781,7.213 74.045,7.213L80.866,7.213C81.309,7.213 81.73,6.861 81.81,6.427L82.188,4.335C82.267,3.9 81.971,3.548 81.529,3.548L73.691,3.548C71.618,3.548 69.638,5.197 69.265,7.234L68.011,14.046C67.639,16.091 69.022,17.751 71.102,17.751Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M95.833,3.529C95.833,3.529 87.654,3.529 87.654,3.529C85.576,3.529 83.592,5.186 83.223,7.228L81.99,14.052C81.621,16.094 83.006,17.751 85.084,17.751L93.263,17.751C95.341,17.751 97.326,16.095 97.695,14.052L98.928,7.228C99.297,5.186 97.911,3.529 95.833,3.529ZM93.488,13.567C93.44,13.828 93.186,14.039 92.921,14.039L86.762,14.039C86.496,14.039 86.319,13.828 86.366,13.567L87.434,7.663C87.481,7.402 87.735,7.191 88,7.191L94.157,7.191C94.423,7.191 94.6,7.402 94.553,7.663L93.488,13.567Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M99.884,17.751L102.557,17.751C102.999,17.751 103.421,17.399 103.5,16.965L103.973,14.348C103.988,14.261 104.073,14.19 104.161,14.19L107.397,14.186C107.557,14.186 107.69,14.265 107.756,14.395L109.281,17.37C109.458,17.722 109.78,17.764 110.751,17.749C111.32,17.756 112.184,17.713 113.577,17.713C114.025,17.713 114.3,17.244 114.079,16.853L112.413,13.953C112.37,13.876 112.417,13.772 112.509,13.727C113.795,13.102 114.814,11.889 115.068,10.487L115.649,7.262C116.02,5.218 114.635,3.562 112.557,3.562L102.448,3.562C102.006,3.562 101.584,3.914 101.505,4.349L99.225,16.964C99.146,17.399 99.442,17.751 99.884,17.751L99.884,17.751ZM105.255,7.268C105.27,7.181 105.354,7.11 105.443,7.11L110.674,7.11C111.069,7.11 111.331,7.424 111.261,7.812L110.877,9.933C110.806,10.319 110.431,10.634 110.038,10.634L104.806,10.634C104.718,10.634 104.66,10.564 104.675,10.475L105.255,7.268Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M116.642,17.751C116.642,17.751 128.586,17.751 128.586,17.751C128.851,17.751 129.105,17.538 129.152,17.278L129.651,14.504C129.698,14.242 129.521,14.031 129.256,14.031L120.955,14.031C120.866,14.031 120.808,13.96 120.823,13.873L121.069,12.508C121.084,12.421 121.169,12.35 121.257,12.35L127.934,12.35C128.2,12.35 128.454,12.137 128.501,11.877L128.945,9.421C128.992,9.159 128.815,8.949 128.55,8.949L121.873,8.949C121.785,8.949 121.726,8.877 121.741,8.79L122.005,7.328C122.02,7.241 122.105,7.17 122.193,7.17L130.495,7.17C130.76,7.17 131.014,6.957 131.061,6.695L131.545,4.021C131.592,3.761 131.415,3.548 131.15,3.548L119.206,3.548C118.763,3.548 118.34,3.902 118.261,4.337L115.98,16.962C115.902,17.397 116.198,17.751 116.642,17.751Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M134.674,0C134.674,0 132.059,0 132.059,0C131.965,0 131.877,0.074 131.86,0.166L131.783,0.594C131.766,0.686 131.828,0.76 131.921,0.76L132.745,0.76C132.764,0.76 132.776,0.775 132.773,0.793L132.406,2.819C132.39,2.91 132.452,2.984 132.545,2.984L133.108,2.984C133.201,2.984 133.29,2.91 133.307,2.819L133.673,0.793C133.676,0.775 133.694,0.76 133.713,0.76L134.536,0.76C134.629,0.76 134.718,0.686 134.735,0.594L134.812,0.166C134.828,0.074 134.767,0 134.674,0Z" style="fill:white;fill-rule:nonzero;"/>
<path d="M135.278,0.002C135.185,0.002 135.096,0.076 135.079,0.167L134.6,2.819C134.583,2.91 134.646,2.984 134.739,2.984L135.247,2.984C135.34,2.984 135.429,2.91 135.446,2.819L135.636,1.763L135.985,2.888C136.002,2.947 136.055,2.984 136.121,2.984L136.794,2.984C136.86,2.984 136.926,2.947 136.964,2.888L137.72,1.758L137.528,2.819C137.512,2.91 137.574,2.984 137.667,2.984L138.176,2.984C138.269,2.984 138.358,2.91 138.374,2.819L138.853,0.167C138.87,0.076 138.808,0.002 138.715,0.002L138.062,0.002C137.997,0.002 137.93,0.039 137.892,0.098L136.652,1.957C136.633,1.987 136.586,1.979 136.575,1.944L136.066,0.098C136.049,0.039 135.996,0.002 135.93,0.002L135.278,0.002Z" style="fill:white;fill-rule:nonzero;"/>
</svg>

Before

Width:  |  Height:  |  Size: 7.1 KiB

-16
View File
@@ -1,16 +0,0 @@
:root {
--md-primary-fg-color: #1F2937;
--md-primary-fg-color--light: #1F2937;
--md-primary-fg-color--dark: #1F2937;
--md-accent-fg-color: #1F2937;
}
/* hide git repo version */
.md-source__fact--version {
display: none;
}
/* underline links */
.md-typeset a {
text-decoration: underline;
}
-36
View File
@@ -1,36 +0,0 @@
/* Docs site of the meshcore-tth fork (mkdocs.tth.yml, theme mkdocs-terminal,
palette "dark"): only what the palette lacks. Green instead of its blue,
and the GitHub callouts (> [!WARNING]) the theme does not style. */
:root {
--primary-color: #5fd38d;
--progress-bar-fill: #5fd38d;
/* plain black; the palette's 60em column was a thin noodle on a wide
screen (user, 2. 12. 2026) */
--background-color: #000;
--invert-font-color: #000;
--code-bg-color: #161616;
--page-width: min(110em, 94vw);
}
.admonition {
border: 1px solid var(--secondary-color);
padding: 0.2em 1em;
margin: var(--global-line-height) 0;
}
.admonition-title {
font-weight: bold;
margin: 0.4em 0 0;
}
.admonition.warning, .admonition.caution, .admonition.danger {
border-color: #e5a50a;
}
.admonition.warning > .admonition-title,
.admonition.caution > .admonition-title,
.admonition.danger > .admonition-title {
color: #e5a50a;
}
.admonition.note > .admonition-title,
.admonition.tip > .admonition-title,
.admonition.important > .admonition-title {
color: var(--primary-color);
}
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Ayush Sharma
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+2
View File
@@ -0,0 +1,2 @@
AsyncElegantOTA KEYWORD1
begin KEYWORD2
@@ -0,0 +1,9 @@
name=AsyncElegantOTA
version=2.2.8
author=Ayush Sharma
category=Communication
maintainer=Ayush Sharma <asrocks5@gmail.com>
sentence=Perform OTAs for ESP8266 & ESP32 Asynchronously.
paragraph=A User Interface Library which provides interactive elements for your Over the Air Updates on ESP8266/ESP32.
url=https://github.com/ayushsharma82/AsyncElegantOTA
architectures=esp8266,esp32
@@ -0,0 +1,129 @@
#include <AsyncElegantOTA.h>
AsyncElegantOtaClass AsyncElegantOTA;
void AsyncElegantOtaClass::setID(const char* id){
_id = id;
}
void AsyncElegantOtaClass::begin(AsyncWebServer *server, const char* username, const char* password){
_server = server;
if(strlen(username) > 0){
_authRequired = true;
_username = username;
_password = password;
}else{
_authRequired = false;
_username = "";
_password = "";
}
_server->on("/update/identity", HTTP_GET, [&](AsyncWebServerRequest *request){
if(_authRequired){
if(!request->authenticate(_username.c_str(), _password.c_str())){
return request->requestAuthentication();
}
}
#if defined(ESP8266)
request->send(200, "application/json", "{\"id\": \""+_id+"\", \"hardware\": \"ESP8266\"}");
#elif defined(ESP32)
request->send(200, "application/json", "{\"id\": \""+_id+"\", \"hardware\": \"ESP32\"}");
#endif
});
_server->on("/update", HTTP_GET, [&](AsyncWebServerRequest *request){
if(_authRequired){
if(!request->authenticate(_username.c_str(), _password.c_str())){
return request->requestAuthentication();
}
}
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", ELEGANT_HTML, ELEGANT_HTML_SIZE);
response->addHeader("Content-Encoding", "gzip");
request->send(response);
});
_server->on("/update", HTTP_POST, [&](AsyncWebServerRequest *request) {
if(_authRequired){
if(!request->authenticate(_username.c_str(), _password.c_str())){
return request->requestAuthentication();
}
}
// the request handler is triggered after the upload has finished...
// create the response, add header, and send response
AsyncWebServerResponse *response = request->beginResponse((Update.hasError())?500:200, "text/plain", (Update.hasError())?"FAIL":"OK");
response->addHeader("Connection", "close");
response->addHeader("Access-Control-Allow-Origin", "*");
request->send(response);
restart();
}, [&](AsyncWebServerRequest *request, String filename, size_t index, uint8_t *data, size_t len, bool final) {
//Upload handler chunks in data
if(_authRequired){
if(!request->authenticate(_username.c_str(), _password.c_str())){
return request->requestAuthentication();
}
}
if (!index) {
if(!request->hasParam("MD5", true)) {
return request->send(400, "text/plain", "MD5 parameter missing");
}
if(!Update.setMD5(request->getParam("MD5", true)->value().c_str())) {
return request->send(400, "text/plain", "MD5 parameter invalid");
}
#if defined(ESP8266)
int cmd = (filename == "filesystem") ? U_FS : U_FLASH;
Update.runAsync(true);
size_t fsSize = ((size_t) &_FS_end - (size_t) &_FS_start);
uint32_t maxSketchSpace = (ESP.getFreeSketchSpace() - 0x1000) & 0xFFFFF000;
if (!Update.begin((cmd == U_FS)?fsSize:maxSketchSpace, cmd)){ // Start with max available size
#elif defined(ESP32)
int cmd = (filename == "filesystem") ? U_SPIFFS : U_FLASH;
if (!Update.begin(UPDATE_SIZE_UNKNOWN, cmd)) { // Start with max available size
#endif
Update.printError(Serial);
return request->send(400, "text/plain", "OTA could not begin");
}
}
// Write chunked data to the free sketch space
if(len){
if (Update.write(data, len) != len) {
return request->send(400, "text/plain", "OTA could not begin");
}
}
if (final) { // if the final flag is set then this is the last frame of data
if (!Update.end(true)) { //true to set the size to the current progress
Update.printError(Serial);
return request->send(400, "text/plain", "Could not end OTA");
}
}else{
return;
}
});
}
// deprecated, keeping for backward compatibility
void AsyncElegantOtaClass::loop() {
}
void AsyncElegantOtaClass::restart() {
yield();
delay(1000);
yield();
ESP.restart();
}
String AsyncElegantOtaClass::getID(){
String id = "";
#if defined(ESP8266)
id = String(ESP.getChipId());
#elif defined(ESP32)
id = String((uint32_t)ESP.getEfuseMac(), HEX);
#endif
id.toUpperCase();
return id;
}
@@ -0,0 +1,52 @@
#ifndef AsyncElegantOTA_h
#define AsyncElegantOTA_h
#warning AsyncElegantOTA library is deprecated, Please consider moving to newer ElegantOTA library which now comes with an Async Mode. Learn More: https://docs.elegantota.pro/async-mode/
#include "Arduino.h"
#include "stdlib_noniso.h"
#if defined(ESP8266)
#include "ESP8266WiFi.h"
#include "ESPAsyncTCP.h"
#include "flash_hal.h"
#include "FS.h"
#elif defined(ESP32)
#include "WiFi.h"
#include "AsyncTCP.h"
#include "Update.h"
#include "esp_int_wdt.h"
#include "esp_task_wdt.h"
#endif
#include "Hash.h"
#include "ESPAsyncWebServer.h"
#include "FS.h"
#include "elegantWebpage.h"
class AsyncElegantOtaClass{
public:
void
setID(const char* id),
begin(AsyncWebServer *server, const char* username = "", const char* password = ""),
loop(),
restart();
private:
AsyncWebServer *_server;
String getID();
String _id = getID();
String _username = "";
String _password = "";
bool _authRequired = false;
};
extern AsyncElegantOtaClass AsyncElegantOTA;
#endif
+38
View File
@@ -0,0 +1,38 @@
/**
* @file Hash.h
* @date 20.05.2015
* @author Markus Sattler
*
* Copyright (c) 2015 Markus Sattler. All rights reserved.
* This file is part of the esp8266 core for Arduino environment.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef HASH_H_
#define HASH_H_
//#define DEBUG_SHA1
void sha1(const uint8_t* data, uint32_t size, uint8_t hash[20]);
void sha1(const char* data, uint32_t size, uint8_t hash[20]);
void sha1(const String& data, uint8_t hash[20]);
String sha1(const uint8_t* data, uint32_t size);
String sha1(const char* data, uint32_t size);
String sha1(const String& data);
#endif /* HASH_H_ */
File diff suppressed because it is too large. Load diff
@@ -0,0 +1 @@
This is LittleFS from Adafruit, stripped from things that makes it not compile with stm32 (refs to TinyUSB and free_rtos, mostly)
@@ -0,0 +1,10 @@
name=Adafruit Little File System Libraries
version=0.11.0
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Arduino library for ARM Little File System
paragraph=Arduino library for ARM Little File System
category=Data Storage
url=https://github.com/adafruit/Adafruit_nRF52_Arduino
architectures=*
includes=Adafruit_LittleFS.h
@@ -0,0 +1,273 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <Arduino.h>
#include <string.h>
#include "Adafruit_LittleFS.h"
//#include <Adafruit_TinyUSB.h> // for Serial
using namespace Adafruit_LittleFS_Namespace;
#define memclr(buffer, size) memset(buffer, 0, size)
#define varclr(_var) memclr(_var, sizeof(*(_var)))
//--------------------------------------------------------------------+
// Implementation
//--------------------------------------------------------------------+
Adafruit_LittleFS::Adafruit_LittleFS (void)
: Adafruit_LittleFS(NULL)
{
}
Adafruit_LittleFS::Adafruit_LittleFS (struct lfs_config* cfg)
{
varclr(&_lfs);
_lfs_cfg = cfg;
_mounted = false;
// _mutex = xSemaphoreCreateMutexStatic(&this->_MutexStorageSpace);
}
Adafruit_LittleFS::~Adafruit_LittleFS ()
{
}
// Initialize and mount the file system
// Return true if mounted successfully else probably corrupted.
// User should format the disk and try again
bool Adafruit_LittleFS::begin (struct lfs_config * cfg)
{
_lockFS();
bool ret;
// not a loop, just an quick way to short-circuit on error
do {
if (_mounted) { ret = true; break; }
if (cfg) { _lfs_cfg = cfg; }
if (nullptr == _lfs_cfg) { ret = false; break; }
// actually attempt to mount, and log error if one occurs
int err = lfs_mount(&_lfs, _lfs_cfg);
PRINT_LFS_ERR(err);
_mounted = (err == LFS_ERR_OK);
ret = _mounted;
} while(0);
_unlockFS();
return ret;
}
// Tear down and unmount file system
void Adafruit_LittleFS::end(void)
{
_lockFS();
if (_mounted)
{
_mounted = false;
int err = lfs_unmount(&_lfs);
PRINT_LFS_ERR(err);
(void)err;
}
_unlockFS();
}
bool Adafruit_LittleFS::format (void)
{
_lockFS();
int err = LFS_ERR_OK;
bool attemptMount = _mounted;
// not a loop, just an quick way to short-circuit on error
do
{
// if already mounted: umount first -> format -> remount
if (_mounted)
{
_mounted = false;
err = lfs_unmount(&_lfs);
if ( LFS_ERR_OK != err) { PRINT_LFS_ERR(err); break; }
}
err = lfs_format(&_lfs, _lfs_cfg);
if ( LFS_ERR_OK != err ) { PRINT_LFS_ERR(err); break; }
if (attemptMount)
{
err = lfs_mount(&_lfs, _lfs_cfg);
if ( LFS_ERR_OK != err ) { PRINT_LFS_ERR(err); break; }
_mounted = true;
}
// success!
} while(0);
_unlockFS();
return LFS_ERR_OK == err;
}
// Open a file or folder
Adafruit_LittleFS_Namespace::File Adafruit_LittleFS::open (char const *filepath, uint8_t mode)
{
// No lock is required here ... the File() object will synchronize with the mutex provided
return Adafruit_LittleFS_Namespace::File(filepath, mode, *this);
}
// Check if file or folder exists
bool Adafruit_LittleFS::exists (char const *filepath)
{
struct lfs_info info;
_lockFS();
bool ret = (0 == lfs_stat(&_lfs, filepath, &info));
_unlockFS();
return ret;
}
// Create a directory, create intermediate parent if needed
bool Adafruit_LittleFS::mkdir (char const *filepath)
{
bool ret = true;
const char* slash = filepath;
if ( slash[0] == '/' ) slash++; // skip root '/'
_lockFS();
// make intermediate parent directory(ies)
while ( NULL != (slash = strchr(slash, '/')) )
{
char parent[slash - filepath + 1] = { 0 };
memcpy(parent, filepath, slash - filepath);
int rc = lfs_mkdir(&_lfs, parent);
if ( rc != LFS_ERR_OK && rc != LFS_ERR_EXIST )
{
PRINT_LFS_ERR(rc);
ret = false;
break;
}
slash++;
}
// make the final requested directory
if (ret)
{
int rc = lfs_mkdir(&_lfs, filepath);
if ( rc != LFS_ERR_OK && rc != LFS_ERR_EXIST )
{
PRINT_LFS_ERR(rc);
ret = false;
}
}
_unlockFS();
return ret;
}
// Remove a file
bool Adafruit_LittleFS::remove (char const *filepath)
{
_lockFS();
int err = lfs_remove(&_lfs, filepath);
PRINT_LFS_ERR(err);
_unlockFS();
return LFS_ERR_OK == err;
}
// Rename a file
bool Adafruit_LittleFS::rename (char const *oldfilepath, char const *newfilepath)
{
_lockFS();
int err = lfs_rename(&_lfs, oldfilepath, newfilepath);
PRINT_LFS_ERR(err);
_unlockFS();
return LFS_ERR_OK == err;
}
// Remove a folder
bool Adafruit_LittleFS::rmdir (char const *filepath)
{
_lockFS();
int err = lfs_remove(&_lfs, filepath);
PRINT_LFS_ERR(err);
_unlockFS();
return LFS_ERR_OK == err;
}
// Remove a folder recursively
bool Adafruit_LittleFS::rmdir_r (char const *filepath)
{
/* adafruit: lfs is modified to remove non-empty folder,
According to below issue, comment these 2 line won't corrupt filesystem
at least when using LFS v1. If moving to LFS v2, see tracked issue
to see if issues (such as the orphans in threaded linked list) are resolved.
https://github.com/ARMmbed/littlefs/issues/43
*/
_lockFS();
int err = lfs_remove(&_lfs, filepath);
PRINT_LFS_ERR(err);
_unlockFS();
return LFS_ERR_OK == err;
}
//------------- Debug -------------//
#if CFG_DEBUG
const char* dbg_strerr_lfs (int32_t err)
{
switch ( err )
{
case LFS_ERR_OK : return "LFS_ERR_OK";
case LFS_ERR_IO : return "LFS_ERR_IO";
case LFS_ERR_CORRUPT : return "LFS_ERR_CORRUPT";
case LFS_ERR_NOENT : return "LFS_ERR_NOENT";
case LFS_ERR_EXIST : return "LFS_ERR_EXIST";
case LFS_ERR_NOTDIR : return "LFS_ERR_NOTDIR";
case LFS_ERR_ISDIR : return "LFS_ERR_ISDIR";
case LFS_ERR_NOTEMPTY : return "LFS_ERR_NOTEMPTY";
case LFS_ERR_BADF : return "LFS_ERR_BADF";
case LFS_ERR_INVAL : return "LFS_ERR_INVAL";
case LFS_ERR_NOSPC : return "LFS_ERR_NOSPC";
case LFS_ERR_NOMEM : return "LFS_ERR_NOMEM";
default:
static char errcode[10];
sprintf(errcode, "%ld", err);
return errcode;
}
return NULL;
}
#endif
@@ -0,0 +1,102 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef ADAFRUIT_LITTLEFS_H_
#define ADAFRUIT_LITTLEFS_H_
#include <Stream.h>
// Internal Flash uses ARM Little FileSystem
// https://github.com/ARMmbed/littlefs
#include "littlefs/lfs.h"
#include "Adafruit_LittleFS_File.h"
//#include "rtos.h" // tied to FreeRTOS for serialization
class Adafruit_LittleFS
{
public:
Adafruit_LittleFS (void);
Adafruit_LittleFS (struct lfs_config* cfg);
virtual ~Adafruit_LittleFS ();
bool begin(struct lfs_config * cfg = NULL);
void end(void);
// Open the specified file/directory with the supplied mode (e.g. read or
// write, etc). Returns a File object for interacting with the file.
// Note that currently only one file can be open at a time.
Adafruit_LittleFS_Namespace::File open (char const *filename, uint8_t mode = Adafruit_LittleFS_Namespace::FILE_O_READ);
// Methods to determine if the requested file path exists.
bool exists (char const *filepath);
// Create the requested directory hierarchy--if intermediate directories
// do not exist they will be created.
bool mkdir (char const *filepath);
// Delete the file.
bool remove (char const *filepath);
// Rename the file.
bool rename (char const *oldfilepath, char const *newfilepath);
// Delete a folder (must be empty)
bool rmdir (char const *filepath);
// Delete a folder (recursively)
bool rmdir_r (char const *filepath);
// format file system
bool format (void);
/*------------------------------------------------------------------*/
/* INTERNAL USAGE ONLY
* Although declare as public, it is meant to be invoked by internal
* code. User should not call these directly
*------------------------------------------------------------------*/
lfs_t* _getFS (void) { return &_lfs; }
void _lockFS (void) { }//xSemaphoreTake(_mutex, portMAX_DELAY); }
void _unlockFS(void) { }//xSemaphoreGive(_mutex); }
protected:
bool _mounted;
struct lfs_config* _lfs_cfg;
lfs_t _lfs;
// SemaphoreHandle_t _mutex;
private:
// StaticSemaphore_t _MutexStorageSpace;
};
#if !CFG_DEBUG
#define VERIFY_LFS(...) _GET_3RD_ARG(__VA_ARGS__, VERIFY_ERR_2ARGS, VERIFY_ERR_1ARGS)(__VA_ARGS__, NULL)
#define PRINT_LFS_ERR(_err)
#else
#define VERIFY_LFS(...) _GET_3RD_ARG(__VA_ARGS__, VERIFY_ERR_2ARGS, VERIFY_ERR_1ARGS)(__VA_ARGS__, dbg_strerr_lfs)
#define PRINT_LFS_ERR(_err) do { if (_err) { VERIFY_MESS((long int)_err, dbg_strerr_lfs); } } while(0) // LFS_ERR are of type int, VERIFY_MESS expects long_int
const char* dbg_strerr_lfs (int32_t err);
#endif
#endif /* ADAFRUIT_LITTLEFS_H_ */
@@ -0,0 +1,420 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <Arduino.h>
#include "Adafruit_LittleFS.h"
#include "littlefs/lfs.h"
//--------------------------------------------------------------------+
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
//--------------------------------------------------------------------+
using namespace Adafruit_LittleFS_Namespace;
File::File (Adafruit_LittleFS &fs)
{
_fs = &fs;
_is_dir = false;
_name[0] = 0;
_name[LFS_NAME_MAX] = 0;
_dir_path = NULL;
_dir = NULL;
_file = NULL;
}
File::File (char const *filename, uint8_t mode, Adafruit_LittleFS &fs)
: File(fs)
{
// public constructor calls public API open(), which will obtain the mutex
this->open(filename, mode);
}
bool File::_open_file (char const *filepath, uint8_t mode)
{
int flags = (mode == FILE_O_READ) ? LFS_O_RDONLY :
(mode == FILE_O_WRITE) ? (LFS_O_RDWR | LFS_O_CREAT) : 0;
if ( flags )
{
_file = (lfs_file_t*) malloc(sizeof(lfs_file_t));
if (!_file) return false;
int rc = lfs_file_open(_fs->_getFS(), _file, filepath, flags);
if ( rc )
{
// failed to open
PRINT_LFS_ERR(rc);
// free memory
free(_file);
_file = NULL;
return false;
}
// move to end of file
if ( mode == FILE_O_WRITE ) lfs_file_seek(_fs->_getFS(), _file, 0, LFS_SEEK_END);
_is_dir = false;
}
return true;
}
bool File::_open_dir (char const *filepath)
{
_dir = (lfs_dir_t*) malloc(sizeof(lfs_dir_t));
if (!_dir) return false;
int rc = lfs_dir_open(_fs->_getFS(), _dir, filepath);
if ( rc )
{
// failed to open
PRINT_LFS_ERR(rc);
// free memory
free(_dir);
_dir = NULL;
return false;
}
_is_dir = true;
_dir_path = (char*) malloc(strlen(filepath) + 1);
strcpy(_dir_path, filepath);
return true;
}
bool File::open (char const *filepath, uint8_t mode)
{
bool ret = false;
_fs->_lockFS();
ret = this->_open(filepath, mode);
_fs->_unlockFS();
return ret;
}
bool File::_open (char const *filepath, uint8_t mode)
{
bool ret = false;
// close if currently opened
if ( this->isOpen() ) _close();
struct lfs_info info;
int rc = lfs_stat(_fs->_getFS(), filepath, &info);
if ( LFS_ERR_OK == rc )
{
// file existed, open file or directory accordingly
ret = (info.type == LFS_TYPE_REG) ? _open_file(filepath, mode) : _open_dir(filepath);
}
else if ( LFS_ERR_NOENT == rc )
{
// file not existed, only proceed with FILE_O_WRITE mode
if ( mode == FILE_O_WRITE ) ret = _open_file(filepath, mode);
}
else
{
PRINT_LFS_ERR(rc);
}
// save bare file name
if (ret)
{
char const* splash = strrchr(filepath, '/');
strncpy(_name, splash ? (splash + 1) : filepath, LFS_NAME_MAX);
}
return ret;
}
size_t File::write (uint8_t ch)
{
return write(&ch, 1);
}
size_t File::write (uint8_t const *buf, size_t size)
{
lfs_ssize_t wrcount = 0;
_fs->_lockFS();
if (!this->_is_dir)
{
wrcount = lfs_file_write(_fs->_getFS(), _file, buf, size);
if (wrcount < 0)
{
wrcount = 0;
}
}
_fs->_unlockFS();
return wrcount;
}
int File::read (void)
{
// this thin wrapper relies on called function to synchronize
int ret = -1;
uint8_t ch;
if (read(&ch, 1) > 0)
{
ret = static_cast<int>(ch);
}
return ret;
}
int File::read (void *buf, uint16_t nbyte)
{
int ret = 0;
_fs->_lockFS();
if (!this->_is_dir)
{
ret = lfs_file_read(_fs->_getFS(), _file, buf, nbyte);
}
_fs->_unlockFS();
return ret;
}
int File::peek (void)
{
int ret = -1;
_fs->_lockFS();
if (!this->_is_dir)
{
uint32_t pos = lfs_file_tell(_fs->_getFS(), _file);
uint8_t ch = 0;
if (lfs_file_read(_fs->_getFS(), _file, &ch, 1) > 0)
{
ret = static_cast<int>(ch);
}
(void) lfs_file_seek(_fs->_getFS(), _file, pos, LFS_SEEK_SET);
}
_fs->_unlockFS();
return ret;
}
int File::available (void)
{
int ret = 0;
_fs->_lockFS();
if (!this->_is_dir)
{
uint32_t size = lfs_file_size(_fs->_getFS(), _file);
uint32_t pos = lfs_file_tell(_fs->_getFS(), _file);
ret = size - pos;
}
_fs->_unlockFS();
return ret;
}
bool File::seek (uint32_t pos)
{
bool ret = false;
_fs->_lockFS();
if (!this->_is_dir)
{
ret = lfs_file_seek(_fs->_getFS(), _file, pos, LFS_SEEK_SET) >= 0;
}
_fs->_unlockFS();
return ret;
}
uint32_t File::position (void)
{
uint32_t ret = 0;
_fs->_lockFS();
if (!this->_is_dir)
{
ret = lfs_file_tell(_fs->_getFS(), _file);
}
_fs->_unlockFS();
return ret;
}
uint32_t File::size (void)
{
uint32_t ret = 0;
_fs->_lockFS();
if (!this->_is_dir)
{
ret = lfs_file_size(_fs->_getFS(), _file);
}
_fs->_unlockFS();
return ret;
}
bool File::truncate (uint32_t pos)
{
int32_t ret=LFS_ERR_ISDIR;
_fs->_lockFS();
if (!this->_is_dir)
{
ret = lfs_file_truncate(_fs->_getFS(), _file, pos);
}
_fs->_unlockFS();
return ( ret == 0 );
}
bool File::truncate (void)
{
int32_t ret=LFS_ERR_ISDIR;
uint32_t pos;
_fs->_lockFS();
if (!this->_is_dir)
{
pos = lfs_file_tell(_fs->_getFS(), _file);
ret = lfs_file_truncate(_fs->_getFS(), _file, pos);
}
_fs->_unlockFS();
return ( ret == 0 );
}
void File::flush (void)
{
_fs->_lockFS();
if (!this->_is_dir)
{
lfs_file_sync(_fs->_getFS(), _file);
}
_fs->_unlockFS();
return;
}
void File::close (void)
{
_fs->_lockFS();
this->_close();
_fs->_unlockFS();
}
void File::_close(void)
{
if ( this->isOpen() )
{
if ( this->_is_dir )
{
lfs_dir_close(_fs->_getFS(), _dir);
free(_dir);
_dir = NULL;
if ( this->_dir_path ) free(_dir_path);
_dir_path = NULL;
}
else
{
lfs_file_close(this->_fs->_getFS(), _file);
free(_file);
_file = NULL;
}
}
}
File::operator bool (void)
{
return isOpen();
}
bool File::isOpen(void)
{
return (_file != NULL) || (_dir != NULL);
}
// WARNING -- although marked as `const`, the values pointed
// to may change. For example, if the same File
// object has `open()` called with a different
// file or directory name, this same pointer will
// suddenly (unexpectedly?) have different values.
char const* File::name (void)
{
return this->_name;
}
bool File::isDirectory (void)
{
return this->_is_dir;
}
File File::openNextFile (uint8_t mode)
{
_fs->_lockFS();
File ret(*_fs);
if (this->_is_dir)
{
struct lfs_info info;
int rc;
// lfs_dir_read returns 0 when reaching end of directory, 1 if found an entry
// Skip the "." and ".." entries ...
do
{
rc = lfs_dir_read(_fs->_getFS(), _dir, &info);
} while ( rc == 1 && (!strcmp(".", info.name) || !strcmp("..", info.name)) );
if ( rc == 1 )
{
// string cat name with current folder
char filepath[strlen(_dir_path) + 1 + strlen(info.name) + 1]; // potential for significant stack usage
strcpy(filepath, _dir_path);
if ( !(_dir_path[0] == '/' && _dir_path[1] == 0) ) strcat(filepath, "/"); // only add '/' if cwd is not root
strcat(filepath, info.name);
(void)ret._open(filepath, mode); // return value is ignored ... caller is expected to check isOpened()
}
else if ( rc < 0 )
{
PRINT_LFS_ERR(rc);
}
}
_fs->_unlockFS();
return ret;
}
void File::rewindDirectory (void)
{
_fs->_lockFS();
if (this->_is_dir)
{
lfs_dir_rewind(_fs->_getFS(), _dir);
}
_fs->_unlockFS();
}
@@ -0,0 +1,108 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef ADAFRUIT_LITTLEFS_FILE_H_
#define ADAFRUIT_LITTLEFS_FILE_H_
// Forward declaration
class Adafruit_LittleFS;
namespace Adafruit_LittleFS_Namespace
{
// avoid conflict with other FileSystem FILE_READ/FILE_WRITE
enum
{
FILE_O_READ = 0,
FILE_O_WRITE = 1,
};
class File : public Stream
{
public:
File (Adafruit_LittleFS &fs);
File (char const *filename, uint8_t mode, Adafruit_LittleFS &fs);
public:
bool open (char const *filename, uint8_t mode);
//------------- Stream API -------------//
virtual size_t write (uint8_t ch);
virtual size_t write (uint8_t const *buf, size_t size);
size_t write(const char *str) {
if (str == NULL) return 0;
return write((const uint8_t *)str, strlen(str));
}
size_t write(const char *buffer, size_t size) {
return write((const uint8_t *)buffer, size);
}
virtual int read (void);
int read (void *buf, uint16_t nbyte);
virtual int peek (void);
virtual int available (void);
virtual void flush (void);
bool seek (uint32_t pos);
uint32_t position (void);
uint32_t size (void);
bool truncate (uint32_t pos);
bool truncate (void);
void close (void);
operator bool (void);
bool isOpen(void);
char const* name (void);
bool isDirectory (void);
File openNextFile (uint8_t mode = FILE_O_READ);
void rewindDirectory (void);
private:
Adafruit_LittleFS* _fs;
bool _is_dir;
union {
lfs_file_t* _file;
lfs_dir_t* _dir;
};
char* _dir_path;
char _name[LFS_NAME_MAX+1];
bool _open(char const *filepath, uint8_t mode);
bool _open_file(char const *filepath, uint8_t mode);
bool _open_dir (char const *filepath);
void _close(void);
};
}
#endif /* ADAFRUIT_LITTLEFS_FILE_H_ */
@@ -0,0 +1,24 @@
Copyright (c) 2017, Arm Limited. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
- Neither the name of ARM nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,177 @@
## The little filesystem
A little fail-safe filesystem designed for embedded systems.
```
| | | .---._____
.-----. | |
--|o |---| littlefs |
--| |---| |
'-----' '----------'
| | |
```
**Bounded RAM/ROM** - The littlefs is designed to work with a limited amount
of memory. Recursion is avoided and dynamic memory is limited to configurable
buffers that can be provided statically.
**Power-loss resilient** - The littlefs is designed for systems that may have
random power failures. The littlefs has strong copy-on-write guarantees and
storage on disk is always kept in a valid state.
**Wear leveling** - Since the most common form of embedded storage is erodible
flash memories, littlefs provides a form of dynamic wear leveling for systems
that can not fit a full flash translation layer.
## Example
Here's a simple example that updates a file named `boot_count` every time
main runs. The program can be interrupted at any time without losing track
of how many times it has been booted and without corrupting the filesystem:
``` c
#include "lfs.h"
// variables used by the filesystem
lfs_t lfs;
lfs_file_t file;
// configuration of the filesystem is provided by this struct
const struct lfs_config cfg = {
// block device operations
.read = user_provided_block_device_read,
.prog = user_provided_block_device_prog,
.erase = user_provided_block_device_erase,
.sync = user_provided_block_device_sync,
// block device configuration
.read_size = 16,
.prog_size = 16,
.block_size = 4096,
.block_count = 128,
.lookahead = 128,
};
// entry point
int main(void) {
// mount the filesystem
int err = lfs_mount(&lfs, &cfg);
// reformat if we can't mount the filesystem
// this should only happen on the first boot
if (err) {
lfs_format(&lfs, &cfg);
lfs_mount(&lfs, &cfg);
}
// read current count
uint32_t boot_count = 0;
lfs_file_open(&lfs, &file, "boot_count", LFS_O_RDWR | LFS_O_CREAT);
lfs_file_read(&lfs, &file, &boot_count, sizeof(boot_count));
// update boot count
boot_count += 1;
lfs_file_rewind(&lfs, &file);
lfs_file_write(&lfs, &file, &boot_count, sizeof(boot_count));
// remember the storage is not updated until the file is closed successfully
lfs_file_close(&lfs, &file);
// release any resources we were using
lfs_unmount(&lfs);
// print the boot count
printf("boot_count: %d\n", boot_count);
}
```
## Usage
Detailed documentation (or at least as much detail as is currently available)
can be found in the comments in [lfs.h](lfs.h).
As you may have noticed, littlefs takes in a configuration structure that
defines how the filesystem operates. The configuration struct provides the
filesystem with the block device operations and dimensions, tweakable
parameters that tradeoff memory usage for performance, and optional
static buffers if the user wants to avoid dynamic memory.
The state of the littlefs is stored in the `lfs_t` type which is left up
to the user to allocate, allowing multiple filesystems to be in use
simultaneously. With the `lfs_t` and configuration struct, a user can
format a block device or mount the filesystem.
Once mounted, the littlefs provides a full set of POSIX-like file and
directory functions, with the deviation that the allocation of filesystem
structures must be provided by the user.
All POSIX operations, such as remove and rename, are atomic, even in event
of power-loss. Additionally, no file updates are actually committed to the
filesystem until sync or close is called on the file.
## Other notes
All littlefs have the potential to return a negative error code. The errors
can be either one of those found in the `enum lfs_error` in [lfs.h](lfs.h),
or an error returned by the user's block device operations.
In the configuration struct, the `prog` and `erase` function provided by the
user may return a `LFS_ERR_CORRUPT` error if the implementation already can
detect corrupt blocks. However, the wear leveling does not depend on the return
code of these functions, instead all data is read back and checked for
integrity.
If your storage caches writes, make sure that the provided `sync` function
flushes all the data to memory and ensures that the next read fetches the data
from memory, otherwise data integrity can not be guaranteed. If the `write`
function does not perform caching, and therefore each `read` or `write` call
hits the memory, the `sync` function can simply return 0.
## Reference material
[DESIGN.md](DESIGN.md) - DESIGN.md contains a fully detailed dive into how
littlefs actually works. I would encourage you to read it since the
solutions and tradeoffs at work here are quite interesting.
[SPEC.md](SPEC.md) - SPEC.md contains the on-disk specification of littlefs
with all the nitty-gritty details. Can be useful for developing tooling.
## Testing
The littlefs comes with a test suite designed to run on a PC using the
[emulated block device](emubd/lfs_emubd.h) found in the emubd directory.
The tests assume a Linux environment and can be started with make:
``` bash
make test
```
## License
The littlefs is provided under the [BSD-3-Clause](https://spdx.org/licenses/BSD-3-Clause.html)
license. See [LICENSE.md](LICENSE.md) for more information. Contributions to
this project are accepted under the same license.
Individual files contain the following tag instead of the full license text.
SPDX-License-Identifier: BSD-3-Clause
This enables machine processing of license information based on the SPDX
License Identifiers that are here available: http://spdx.org/licenses/
## Related projects
[Mbed OS](https://github.com/ARMmbed/mbed-os/tree/master/features/filesystem/littlefs) -
The easiest way to get started with littlefs is to jump into [Mbed](https://os.mbed.com/),
which already has block device drivers for most forms of embedded storage. The
littlefs is available in Mbed OS as the [LittleFileSystem](https://os.mbed.com/docs/latest/reference/littlefilesystem.html)
class.
[littlefs-fuse](https://github.com/geky/littlefs-fuse) - A [FUSE](https://github.com/libfuse/libfuse)
wrapper for littlefs. The project allows you to mount littlefs directly on a
Linux machine. Can be useful for debugging littlefs if you have an SD card
handy.
[littlefs-js](https://github.com/geky/littlefs-js) - A javascript wrapper for
littlefs. I'm not sure why you would want this, but it is handy for demos.
You can see it in action [here](http://littlefs.geky.net/demo.html).
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,501 @@
/*
* The little filesystem
*
* Copyright (c) 2017, Arm Limited. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef LFS_H
#define LFS_H
#include <stdint.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C"
{
#endif
/// Version info ///
// Software library version
// Major (top-nibble), incremented on backwards incompatible changes
// Minor (bottom-nibble), incremented on feature additions
#define LFS_VERSION 0x00010007
#define LFS_VERSION_MAJOR (0xffff & (LFS_VERSION >> 16))
#define LFS_VERSION_MINOR (0xffff & (LFS_VERSION >> 0))
// Version of On-disk data structures
// Major (top-nibble), incremented on backwards incompatible changes
// Minor (bottom-nibble), incremented on feature additions
#define LFS_DISK_VERSION 0x00010001
#define LFS_DISK_VERSION_MAJOR (0xffff & (LFS_DISK_VERSION >> 16))
#define LFS_DISK_VERSION_MINOR (0xffff & (LFS_DISK_VERSION >> 0))
/// Definitions ///
// Type definitions
typedef uint32_t lfs_size_t;
typedef uint32_t lfs_off_t;
typedef int32_t lfs_ssize_t;
typedef int32_t lfs_soff_t;
typedef uint32_t lfs_block_t;
// Max name size in bytes
#ifndef LFS_NAME_MAX
#define LFS_NAME_MAX 255
#endif
// Max file size in bytes
#ifndef LFS_FILE_MAX
#define LFS_FILE_MAX 2147483647
#endif
// Possible error codes, these are negative to allow
// valid positive return values
enum lfs_error {
LFS_ERR_OK = 0, // No error
LFS_ERR_IO = -5, // Error during device operation
LFS_ERR_CORRUPT = -52, // Corrupted
LFS_ERR_NOENT = -2, // No directory entry
LFS_ERR_EXIST = -17, // Entry already exists
LFS_ERR_NOTDIR = -20, // Entry is not a dir
LFS_ERR_ISDIR = -21, // Entry is a dir
LFS_ERR_NOTEMPTY = -39, // Dir is not empty
LFS_ERR_BADF = -9, // Bad file number
LFS_ERR_FBIG = -27, // File too large
LFS_ERR_INVAL = -22, // Invalid parameter
LFS_ERR_NOSPC = -28, // No space left on device
LFS_ERR_NOMEM = -12, // No more memory available
};
// File types
enum lfs_type {
LFS_TYPE_REG = 0x11,
LFS_TYPE_DIR = 0x22,
LFS_TYPE_SUPERBLOCK = 0x2e,
};
// File open flags
enum lfs_open_flags {
// open flags
LFS_O_RDONLY = 1, // Open a file as read only
LFS_O_WRONLY = 2, // Open a file as write only
LFS_O_RDWR = 3, // Open a file as read and write
LFS_O_CREAT = 0x0100, // Create a file if it does not exist
LFS_O_EXCL = 0x0200, // Fail if a file already exists
LFS_O_TRUNC = 0x0400, // Truncate the existing file to zero size
LFS_O_APPEND = 0x0800, // Move to end of file on every write
// internally used flags
LFS_F_DIRTY = 0x10000, // File does not match storage
LFS_F_WRITING = 0x20000, // File has been written since last flush
LFS_F_READING = 0x40000, // File has been read since last flush
LFS_F_ERRED = 0x80000, // An error occured during write
};
// File seek flags
enum lfs_whence_flags {
LFS_SEEK_SET = 0, // Seek relative to an absolute position
LFS_SEEK_CUR = 1, // Seek relative to the current file position
LFS_SEEK_END = 2, // Seek relative to the end of the file
};
// Configuration provided during initialization of the littlefs
struct lfs_config {
// Opaque user provided context that can be used to pass
// information to the block device operations
void *context;
// Read a region in a block. Negative error codes are propogated
// to the user.
int (*read)(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, void *buffer, lfs_size_t size);
// Program a region in a block. The block must have previously
// been erased. Negative error codes are propogated to the user.
// May return LFS_ERR_CORRUPT if the block should be considered bad.
int (*prog)(const struct lfs_config *c, lfs_block_t block,
lfs_off_t off, const void *buffer, lfs_size_t size);
// Erase a block. A block must be erased before being programmed.
// The state of an erased block is undefined. Negative error codes
// are propogated to the user.
// May return LFS_ERR_CORRUPT if the block should be considered bad.
int (*erase)(const struct lfs_config *c, lfs_block_t block);
// Sync the state of the underlying block device. Negative error codes
// are propogated to the user.
int (*sync)(const struct lfs_config *c);
// Minimum size of a block read. This determines the size of read buffers.
// This may be larger than the physical read size to improve performance
// by caching more of the block device.
lfs_size_t read_size;
// Minimum size of a block program. This determines the size of program
// buffers. This may be larger than the physical program size to improve
// performance by caching more of the block device.
// Must be a multiple of the read size.
lfs_size_t prog_size;
// Size of an erasable block. This does not impact ram consumption and
// may be larger than the physical erase size. However, this should be
// kept small as each file currently takes up an entire block.
// Must be a multiple of the program size.
lfs_size_t block_size;
// Number of erasable blocks on the device.
lfs_size_t block_count;
// Number of blocks to lookahead during block allocation. A larger
// lookahead reduces the number of passes required to allocate a block.
// The lookahead buffer requires only 1 bit per block so it can be quite
// large with little ram impact. Should be a multiple of 32.
lfs_size_t lookahead;
// Optional, statically allocated read buffer. Must be read sized.
void *read_buffer;
// Optional, statically allocated program buffer. Must be program sized.
void *prog_buffer;
// Optional, statically allocated lookahead buffer. Must be 1 bit per
// lookahead block.
void *lookahead_buffer;
// Optional, statically allocated buffer for files. Must be program sized.
// If enabled, only one file may be opened at a time.
void *file_buffer;
};
// Optional configuration provided during lfs_file_opencfg
struct lfs_file_config {
// Optional, statically allocated buffer for files. Must be program sized.
// If NULL, malloc will be used by default.
void *buffer;
};
// File info structure
struct lfs_info {
// Type of the file, either LFS_TYPE_REG or LFS_TYPE_DIR
uint8_t type;
// Size of the file, only valid for REG files
lfs_size_t size;
// Name of the file stored as a null-terminated string
char name[LFS_NAME_MAX+1];
};
/// littlefs data structures ///
typedef struct lfs_entry {
lfs_off_t off;
struct lfs_disk_entry {
uint8_t type;
uint8_t elen;
uint8_t alen;
uint8_t nlen;
union {
struct {
lfs_block_t head;
lfs_size_t size;
} file;
lfs_block_t dir[2];
} u;
} d;
} lfs_entry_t;
typedef struct lfs_cache {
lfs_block_t block;
lfs_off_t off;
uint8_t *buffer;
} lfs_cache_t;
typedef struct lfs_file {
struct lfs_file *next;
lfs_block_t pair[2];
lfs_off_t poff;
lfs_block_t head;
lfs_size_t size;
const struct lfs_file_config *cfg;
uint32_t flags;
lfs_off_t pos;
lfs_block_t block;
lfs_off_t off;
lfs_cache_t cache;
} lfs_file_t;
typedef struct lfs_dir {
struct lfs_dir *next;
lfs_block_t pair[2];
lfs_off_t off;
lfs_block_t head[2];
lfs_off_t pos;
struct lfs_disk_dir {
uint32_t rev;
lfs_size_t size;
lfs_block_t tail[2];
} d;
} lfs_dir_t;
typedef struct lfs_superblock {
lfs_off_t off;
struct lfs_disk_superblock {
uint8_t type;
uint8_t elen;
uint8_t alen;
uint8_t nlen;
lfs_block_t root[2];
uint32_t block_size;
uint32_t block_count;
uint32_t version;
char magic[8];
} d;
} lfs_superblock_t;
typedef struct lfs_free {
lfs_block_t off;
lfs_block_t size;
lfs_block_t i;
lfs_block_t ack;
uint32_t *buffer;
} lfs_free_t;
// The littlefs type
typedef struct lfs {
const struct lfs_config *cfg;
lfs_block_t root[2];
lfs_file_t *files;
lfs_dir_t *dirs;
lfs_cache_t rcache;
lfs_cache_t pcache;
lfs_free_t free;
bool deorphaned;
bool moving;
} lfs_t;
/// Filesystem functions ///
// Format a block device with the littlefs
//
// Requires a littlefs object and config struct. This clobbers the littlefs
// object, and does not leave the filesystem mounted. The config struct must
// be zeroed for defaults and backwards compatibility.
//
// Returns a negative error code on failure.
int lfs_format(lfs_t *lfs, const struct lfs_config *config);
// Mounts a littlefs
//
// Requires a littlefs object and config struct. Multiple filesystems
// may be mounted simultaneously with multiple littlefs objects. Both
// lfs and config must be allocated while mounted. The config struct must
// be zeroed for defaults and backwards compatibility.
//
// Returns a negative error code on failure.
int lfs_mount(lfs_t *lfs, const struct lfs_config *config);
// Unmounts a littlefs
//
// Does nothing besides releasing any allocated resources.
// Returns a negative error code on failure.
int lfs_unmount(lfs_t *lfs);
/// General operations ///
// Removes a file or directory
//
// If removing a directory, the directory must be empty.
// Returns a negative error code on failure.
int lfs_remove(lfs_t *lfs, const char *path);
// Rename or move a file or directory
//
// If the destination exists, it must match the source in type.
// If the destination is a directory, the directory must be empty.
//
// Returns a negative error code on failure.
int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath);
// Find info about a file or directory
//
// Fills out the info structure, based on the specified file or directory.
// Returns a negative error code on failure.
int lfs_stat(lfs_t *lfs, const char *path, struct lfs_info *info);
/// File operations ///
// Open a file
//
// The mode that the file is opened in is determined by the flags, which
// are values from the enum lfs_open_flags that are bitwise-ored together.
//
// Returns a negative error code on failure.
int lfs_file_open(lfs_t *lfs, lfs_file_t *file,
const char *path, int flags);
// Open a file with extra configuration
//
// The mode that the file is opened in is determined by the flags, which
// are values from the enum lfs_open_flags that are bitwise-ored together.
//
// The config struct provides additional config options per file as described
// above. The config struct must be allocated while the file is open, and the
// config struct must be zeroed for defaults and backwards compatibility.
//
// Returns a negative error code on failure.
int lfs_file_opencfg(lfs_t *lfs, lfs_file_t *file,
const char *path, int flags,
const struct lfs_file_config *config);
// Close a file
//
// Any pending writes are written out to storage as though
// sync had been called and releases any allocated resources.
//
// Returns a negative error code on failure.
int lfs_file_close(lfs_t *lfs, lfs_file_t *file);
// Synchronize a file on storage
//
// Any pending writes are written out to storage.
// Returns a negative error code on failure.
int lfs_file_sync(lfs_t *lfs, lfs_file_t *file);
// Read data from file
//
// Takes a buffer and size indicating where to store the read data.
// Returns the number of bytes read, or a negative error code on failure.
lfs_ssize_t lfs_file_read(lfs_t *lfs, lfs_file_t *file,
void *buffer, lfs_size_t size);
// Write data to file
//
// Takes a buffer and size indicating the data to write. The file will not
// actually be updated on the storage until either sync or close is called.
//
// Returns the number of bytes written, or a negative error code on failure.
lfs_ssize_t lfs_file_write(lfs_t *lfs, lfs_file_t *file,
const void *buffer, lfs_size_t size);
// Change the position of the file
//
// The change in position is determined by the offset and whence flag.
// Returns the old position of the file, or a negative error code on failure.
lfs_soff_t lfs_file_seek(lfs_t *lfs, lfs_file_t *file,
lfs_soff_t off, int whence);
// Truncates the size of the file to the specified size
//
// Returns a negative error code on failure.
int lfs_file_truncate(lfs_t *lfs, lfs_file_t *file, lfs_off_t size);
// Return the position of the file
//
// Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR)
// Returns the position of the file, or a negative error code on failure.
lfs_soff_t lfs_file_tell(lfs_t *lfs, lfs_file_t *file);
// Change the position of the file to the beginning of the file
//
// Equivalent to lfs_file_seek(lfs, file, 0, LFS_SEEK_CUR)
// Returns a negative error code on failure.
int lfs_file_rewind(lfs_t *lfs, lfs_file_t *file);
// Return the size of the file
//
// Similar to lfs_file_seek(lfs, file, 0, LFS_SEEK_END)
// Returns the size of the file, or a negative error code on failure.
lfs_soff_t lfs_file_size(lfs_t *lfs, lfs_file_t *file);
/// Directory operations ///
// Create a directory
//
// Returns a negative error code on failure.
int lfs_mkdir(lfs_t *lfs, const char *path);
// Open a directory
//
// Once open a directory can be used with read to iterate over files.
// Returns a negative error code on failure.
int lfs_dir_open(lfs_t *lfs, lfs_dir_t *dir, const char *path);
// Close a directory
//
// Releases any allocated resources.
// Returns a negative error code on failure.
int lfs_dir_close(lfs_t *lfs, lfs_dir_t *dir);
// Read an entry in the directory
//
// Fills out the info structure, based on the specified file or directory.
// Returns a negative error code on failure.
int lfs_dir_read(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info);
// Change the position of the directory
//
// The new off must be a value previous returned from tell and specifies
// an absolute offset in the directory seek.
//
// Returns a negative error code on failure.
int lfs_dir_seek(lfs_t *lfs, lfs_dir_t *dir, lfs_off_t off);
// Return the position of the directory
//
// The returned offset is only meant to be consumed by seek and may not make
// sense, but does indicate the current position in the directory iteration.
//
// Returns the position of the directory, or a negative error code on failure.
lfs_soff_t lfs_dir_tell(lfs_t *lfs, lfs_dir_t *dir);
// Change the position of the directory to the beginning of the directory
//
// Returns a negative error code on failure.
int lfs_dir_rewind(lfs_t *lfs, lfs_dir_t *dir);
/// Miscellaneous littlefs specific operations ///
// Traverse through all blocks in use by the filesystem
//
// The provided callback will be called with each block address that is
// currently in use by the filesystem. This can be used to determine which
// blocks are in use or how much of the storage is available.
//
// Returns a negative error code on failure.
int lfs_traverse(lfs_t *lfs, int (*cb)(void*, lfs_block_t), void *data);
// Prunes any recoverable errors that may have occured in the filesystem
//
// Not needed to be called by user unless an operation is interrupted
// but the filesystem is still mounted. This is already called on first
// allocation.
//
// Returns a negative error code on failure.
int lfs_deorphan(lfs_t *lfs);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
@@ -0,0 +1,31 @@
/*
* lfs util functions
*
* Copyright (c) 2017, Arm Limited. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/
#include "lfs_util.h"
// Only compile if user does not provide custom config
#ifndef LFS_CONFIG
// Software CRC implementation with small lookup table
void lfs_crc(uint32_t *restrict crc, const void *buffer, size_t size) {
static const uint32_t rtable[16] = {
0x00000000, 0x1db71064, 0x3b6e20c8, 0x26d930ac,
0x76dc4190, 0x6b6b51f4, 0x4db26158, 0x5005713c,
0xedb88320, 0xf00f9344, 0xd6d6a3e8, 0xcb61b38c,
0x9b64c2b0, 0x86d3d2d4, 0xa00ae278, 0xbdbdf21c,
};
const uint8_t *data = buffer;
for (size_t i = 0; i < size; i++) {
*crc = (*crc >> 4) ^ rtable[(*crc ^ (data[i] >> 0)) & 0xf];
*crc = (*crc >> 4) ^ rtable[(*crc ^ (data[i] >> 4)) & 0xf];
}
}
#endif
@@ -0,0 +1,197 @@
/*
* lfs utility functions
*
* Copyright (c) 2017, Arm Limited. All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef LFS_UTIL_H
#define LFS_UTIL_H
// Users can override lfs_util.h with their own configuration by defining
// LFS_CONFIG as a header file to include (-DLFS_CONFIG=lfs_config.h).
//
// If LFS_CONFIG is used, none of the default utils will be emitted and must be
// provided by the config file. To start I would suggest copying lfs_util.h and
// modifying as needed.
#ifdef LFS_CONFIG
#define LFS_STRINGIZE(x) LFS_STRINGIZE2(x)
#define LFS_STRINGIZE2(x) #x
#include LFS_STRINGIZE(LFS_CONFIG)
#else
// System includes
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#ifndef LFS_NO_MALLOC
#include <stdlib.h>
#endif
#ifndef LFS_NO_ASSERT
#include <assert.h>
#endif
#if !CFG_DEBUG
#define LFS_NO_DEBUG
#define LFS_NO_WARN
#define LFS_NO_ERROR
#endif
#if !defined(LFS_NO_DEBUG) || !defined(LFS_NO_WARN) || !defined(LFS_NO_ERROR)
#include <stdio.h>
#endif
#ifdef __cplusplus
extern "C"
{
#endif
// Macros, may be replaced by system specific wrappers. Arguments to these
// macros must not have side-effects as the macros can be removed for a smaller
// code footprint
// Logging functions
#ifndef LFS_NO_DEBUG
#define LFS_DEBUG(fmt, ...) \
printf("lfs debug:%d: " fmt "\n", __LINE__, __VA_ARGS__)
#else
#define LFS_DEBUG(fmt, ...)
#endif
#ifndef LFS_NO_WARN
#define LFS_WARN(fmt, ...) \
printf("lfs warn:%d: " fmt "\n", __LINE__, __VA_ARGS__)
#else
#define LFS_WARN(fmt, ...)
#endif
#ifndef LFS_NO_ERROR
#define LFS_ERROR(fmt, ...) \
printf("lfs error:%d: " fmt "\n", __LINE__, __VA_ARGS__)
#else
#define LFS_ERROR(fmt, ...)
#endif
// Runtime assertions
#ifndef LFS_NO_ASSERT
#define LFS_ASSERT(test) assert(test)
#else
#define LFS_ASSERT(test)
#endif
// Builtin functions, these may be replaced by more efficient
// toolchain-specific implementations. LFS_NO_INTRINSICS falls back to a more
// expensive basic C implementation for debugging purposes
// Min/max functions for unsigned 32-bit numbers
static inline uint32_t lfs_max(uint32_t a, uint32_t b) {
return (a > b) ? a : b;
}
static inline uint32_t lfs_min(uint32_t a, uint32_t b) {
return (a < b) ? a : b;
}
// Find the next smallest power of 2 less than or equal to a
static inline uint32_t lfs_npw2(uint32_t a) {
#if !defined(LFS_NO_INTRINSICS) && (defined(__GNUC__) || defined(__CC_ARM))
return 32 - __builtin_clz(a-1);
#else
uint32_t r = 0;
uint32_t s;
a -= 1;
s = (a > 0xffff) << 4; a >>= s; r |= s;
s = (a > 0xff ) << 3; a >>= s; r |= s;
s = (a > 0xf ) << 2; a >>= s; r |= s;
s = (a > 0x3 ) << 1; a >>= s; r |= s;
return (r | (a >> 1)) + 1;
#endif
}
// Count the number of trailing binary zeros in a
// lfs_ctz(0) may be undefined
static inline uint32_t lfs_ctz(uint32_t a) {
#if !defined(LFS_NO_INTRINSICS) && defined(__GNUC__)
return __builtin_ctz(a);
#else
return lfs_npw2((a & -a) + 1) - 1;
#endif
}
// Count the number of binary ones in a
static inline uint32_t lfs_popc(uint32_t a) {
#if !defined(LFS_NO_INTRINSICS) && (defined(__GNUC__) || defined(__CC_ARM))
return __builtin_popcount(a);
#else
a = a - ((a >> 1) & 0x55555555);
a = (a & 0x33333333) + ((a >> 2) & 0x33333333);
return (((a + (a >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
#endif
}
// Find the sequence comparison of a and b, this is the distance
// between a and b ignoring overflow
static inline int lfs_scmp(uint32_t a, uint32_t b) {
return (int)(unsigned)(a - b);
}
// Convert from 32-bit little-endian to native order
static inline uint32_t lfs_fromle32(uint32_t a) {
#if !defined(LFS_NO_INTRINSICS) && ( \
(defined( BYTE_ORDER ) && BYTE_ORDER == ORDER_LITTLE_ENDIAN ) || \
(defined(__BYTE_ORDER ) && __BYTE_ORDER == __ORDER_LITTLE_ENDIAN ) || \
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
return a;
#elif !defined(LFS_NO_INTRINSICS) && ( \
(defined( BYTE_ORDER ) && BYTE_ORDER == ORDER_BIG_ENDIAN ) || \
(defined(__BYTE_ORDER ) && __BYTE_ORDER == __ORDER_BIG_ENDIAN ) || \
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
return __builtin_bswap32(a);
#else
return (((uint8_t*)&a)[0] << 0) |
(((uint8_t*)&a)[1] << 8) |
(((uint8_t*)&a)[2] << 16) |
(((uint8_t*)&a)[3] << 24);
#endif
}
// Convert to 32-bit little-endian from native order
static inline uint32_t lfs_tole32(uint32_t a) {
return lfs_fromle32(a);
}
// Calculate CRC-32 with polynomial = 0x04c11db7
void lfs_crc(uint32_t *crc, const void *buffer, size_t size);
// Allocate memory, only used if buffers are not provided to littlefs
static inline void *lfs_malloc(size_t size) {
#ifndef LFS_NO_MALLOC
//extern void *pvPortMalloc( size_t xWantedSize );
//return pvPortMalloc(size);
return malloc(size);
#else
(void)size;
return NULL;
#endif
}
// Deallocate memory, only used if buffers are not provided to littlefs
static inline void lfs_free(void *p) {
#ifndef LFS_NO_MALLOC
//extern void vPortFree( void *pv );
//vPortFree(p);
free(p);
#else
(void)p;
#endif
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
#endif
+10
View File
@@ -0,0 +1,10 @@
Import("env")
# Make custom HEX from ELF
env.AddPostAction(
"$BUILD_DIR/${PROGNAME}.elf",
env.VerboseAction(" ".join([
"$OBJCOPY", "-O", "ihex", "-R", ".eeprom",
'"$BUILD_DIR/${PROGNAME}.elf"', '"$BUILD_DIR/${PROGNAME}.hex"'
]), "Building $BUILD_DIR/${PROGNAME}.hex")
)
+361
View File
@@ -0,0 +1,361 @@
#!/usr/bin/env python3
import sys
import struct
import subprocess
import re
import os
import os.path
import argparse
import json
from time import sleep
UF2_MAGIC_START0 = 0x0A324655 # "UF2\n"
UF2_MAGIC_START1 = 0x9E5D5157 # Randomly selected
UF2_MAGIC_END = 0x0AB16F30 # Ditto
INFO_FILE = "/INFO_UF2.TXT"
appstartaddr = 0x2000
familyid = 0x0
def is_uf2(buf):
w = struct.unpack("<II", buf[0:8])
return w[0] == UF2_MAGIC_START0 and w[1] == UF2_MAGIC_START1
def is_hex(buf):
try:
w = buf[0:30].decode("utf-8")
except UnicodeDecodeError:
return False
if w[0] == ':' and re.match(rb"^[:0-9a-fA-F\r\n]+$", buf):
return True
return False
def convert_from_uf2(buf):
global appstartaddr
global familyid
numblocks = len(buf) // 512
curraddr = None
currfamilyid = None
families_found = {}
prev_flag = None
all_flags_same = True
outp = []
for blockno in range(numblocks):
ptr = blockno * 512
block = buf[ptr:ptr + 512]
hd = struct.unpack(b"<IIIIIIII", block[0:32])
if hd[0] != UF2_MAGIC_START0 or hd[1] != UF2_MAGIC_START1:
print("Skipping block at " + ptr + "; bad magic")
continue
if hd[2] & 1:
# NO-flash flag set; skip block
continue
datalen = hd[4]
if datalen > 476:
assert False, "Invalid UF2 data size at " + ptr
newaddr = hd[3]
if (hd[2] & 0x2000) and (currfamilyid == None):
currfamilyid = hd[7]
if curraddr == None or ((hd[2] & 0x2000) and hd[7] != currfamilyid):
currfamilyid = hd[7]
curraddr = newaddr
if familyid == 0x0 or familyid == hd[7]:
appstartaddr = newaddr
padding = newaddr - curraddr
if padding < 0:
assert False, "Block out of order at " + ptr
if padding > 10*1024*1024:
assert False, "More than 10M of padding needed at " + ptr
if padding % 4 != 0:
assert False, "Non-word padding size at " + ptr
while padding > 0:
padding -= 4
outp.append(b"\x00\x00\x00\x00")
if familyid == 0x0 or ((hd[2] & 0x2000) and familyid == hd[7]):
outp.append(block[32 : 32 + datalen])
curraddr = newaddr + datalen
if hd[2] & 0x2000:
if hd[7] in families_found.keys():
if families_found[hd[7]] > newaddr:
families_found[hd[7]] = newaddr
else:
families_found[hd[7]] = newaddr
if prev_flag == None:
prev_flag = hd[2]
if prev_flag != hd[2]:
all_flags_same = False
if blockno == (numblocks - 1):
print("--- UF2 File Header Info ---")
families = load_families()
for family_hex in families_found.keys():
family_short_name = ""
for name, value in families.items():
if value == family_hex:
family_short_name = name
print("Family ID is {:s}, hex value is 0x{:08x}".format(family_short_name,family_hex))
print("Target Address is 0x{:08x}".format(families_found[family_hex]))
if all_flags_same:
print("All block flag values consistent, 0x{:04x}".format(hd[2]))
else:
print("Flags were not all the same")
print("----------------------------")
if len(families_found) > 1 and familyid == 0x0:
outp = []
appstartaddr = 0x0
return b"".join(outp)
def convert_to_carray(file_content):
outp = "const unsigned long bindata_len = %d;\n" % len(file_content)
outp += "const unsigned char bindata[] __attribute__((aligned(16))) = {"
for i in range(len(file_content)):
if i % 16 == 0:
outp += "\n"
outp += "0x%02x, " % file_content[i]
outp += "\n};\n"
return bytes(outp, "utf-8")
def convert_to_uf2(file_content):
global familyid
datapadding = b""
while len(datapadding) < 512 - 256 - 32 - 4:
datapadding += b"\x00\x00\x00\x00"
numblocks = (len(file_content) + 255) // 256
outp = []
for blockno in range(numblocks):
ptr = 256 * blockno
chunk = file_content[ptr:ptr + 256]
flags = 0x0
if familyid:
flags |= 0x2000
hd = struct.pack(b"<IIIIIIII",
UF2_MAGIC_START0, UF2_MAGIC_START1,
flags, ptr + appstartaddr, 256, blockno, numblocks, familyid)
while len(chunk) < 256:
chunk += b"\x00"
block = hd + chunk + datapadding + struct.pack(b"<I", UF2_MAGIC_END)
assert len(block) == 512
outp.append(block)
return b"".join(outp)
class Block:
def __init__(self, addr, default_data=0xFF):
self.addr = addr
self.bytes = bytearray([default_data] * 256)
def encode(self, blockno, numblocks):
global familyid
flags = 0x0
if familyid:
flags |= 0x2000
hd = struct.pack("<IIIIIIII",
UF2_MAGIC_START0, UF2_MAGIC_START1,
flags, self.addr, 256, blockno, numblocks, familyid)
hd += self.bytes[0:256]
while len(hd) < 512 - 4:
hd += b"\x00"
hd += struct.pack("<I", UF2_MAGIC_END)
return hd
def convert_from_hex_to_uf2(buf):
global appstartaddr
appstartaddr = None
upper = 0
currblock = None
blocks = []
for line in buf.split('\n'):
if line[0] != ":":
continue
i = 1
rec = []
while i < len(line) - 1:
rec.append(int(line[i:i+2], 16))
i += 2
tp = rec[3]
if tp == 4:
upper = ((rec[4] << 8) | rec[5]) << 16
elif tp == 2:
upper = ((rec[4] << 8) | rec[5]) << 4
elif tp == 1:
break
elif tp == 0:
addr = upper + ((rec[1] << 8) | rec[2])
if appstartaddr == None:
appstartaddr = addr
i = 4
while i < len(rec) - 1:
if not currblock or currblock.addr & ~0xff != addr & ~0xff:
currblock = Block(addr & ~0xff)
blocks.append(currblock)
currblock.bytes[addr & 0xff] = rec[i]
addr += 1
i += 1
numblocks = len(blocks)
resfile = b""
for i in range(0, numblocks):
resfile += blocks[i].encode(i, numblocks)
return resfile
def to_str(b):
return b.decode("utf-8")
def get_drives():
drives = []
if sys.platform == "win32":
r = subprocess.check_output(["wmic", "PATH", "Win32_LogicalDisk",
"get", "DeviceID,", "VolumeName,",
"FileSystem,", "DriveType"])
for line in to_str(r).split('\n'):
words = re.split(r'\s+', line)
if len(words) >= 3 and words[1] == "2" and words[2] == "FAT":
drives.append(words[0])
else:
searchpaths = ["/media"]
if sys.platform == "darwin":
searchpaths = ["/Volumes"]
elif sys.platform == "linux":
searchpaths += ["/media/" + os.environ["USER"], '/run/media/' + os.environ["USER"]]
for rootpath in searchpaths:
if os.path.isdir(rootpath):
for d in os.listdir(rootpath):
if os.path.isdir(rootpath):
drives.append(os.path.join(rootpath, d))
def has_info(d):
try:
return os.path.isfile(d + INFO_FILE)
except:
return False
return list(filter(has_info, drives))
def board_id(path):
with open(path + INFO_FILE, mode='r') as file:
file_content = file.read()
return re.search(r"Board-ID: ([^\r\n]*)", file_content).group(1)
def list_drives():
for d in get_drives():
print(d, board_id(d))
def write_file(name, buf):
with open(name, "wb") as f:
f.write(buf)
print("Wrote %d bytes to %s" % (len(buf), name))
def load_families():
# The expectation is that the `uf2families.json` file is in the same
# directory as this script. Make a path that works using `__file__`
# which contains the full path to this script.
filename = "uf2families.json"
pathname = os.path.join(os.path.dirname(os.path.abspath(__file__)), filename)
with open(pathname) as f:
raw_families = json.load(f)
families = {}
for family in raw_families:
families[family["short_name"]] = int(family["id"], 0)
return families
def main():
global appstartaddr, familyid
def error(msg):
print(msg, file=sys.stderr)
sys.exit(1)
parser = argparse.ArgumentParser(description='Convert to UF2 or flash directly.')
parser.add_argument('input', metavar='INPUT', type=str, nargs='?',
help='input file (HEX, BIN or UF2)')
parser.add_argument('-b', '--base', dest='base', type=str,
default="0x2000",
help='set base address of application for BIN format (default: 0x2000)')
parser.add_argument('-f', '--family', dest='family', type=str,
default="0x0",
help='specify familyID - number or name (default: 0x0)')
parser.add_argument('-o', '--output', metavar="FILE", dest='output', type=str,
help='write output to named file; defaults to "flash.uf2" or "flash.bin" where sensible')
parser.add_argument('-d', '--device', dest="device_path",
help='select a device path to flash')
parser.add_argument('-l', '--list', action='store_true',
help='list connected devices')
parser.add_argument('-c', '--convert', action='store_true',
help='do not flash, just convert')
parser.add_argument('-D', '--deploy', action='store_true',
help='just flash, do not convert')
parser.add_argument('-w', '--wait', action='store_true',
help='wait for device to flash')
parser.add_argument('-C', '--carray', action='store_true',
help='convert binary file to a C array, not UF2')
parser.add_argument('-i', '--info', action='store_true',
help='display header information from UF2, do not convert')
args = parser.parse_args()
appstartaddr = int(args.base, 0)
families = load_families()
if args.family.upper() in families:
familyid = families[args.family.upper()]
else:
try:
familyid = int(args.family, 0)
except ValueError:
error("Family ID needs to be a number or one of: " + ", ".join(families.keys()))
if args.list:
list_drives()
else:
if not args.input:
error("Need input file")
with open(args.input, mode='rb') as f:
inpbuf = f.read()
from_uf2 = is_uf2(inpbuf)
ext = "uf2"
if args.deploy:
outbuf = inpbuf
elif from_uf2 and not args.info:
outbuf = convert_from_uf2(inpbuf)
ext = "bin"
elif from_uf2 and args.info:
outbuf = ""
convert_from_uf2(inpbuf)
elif is_hex(inpbuf):
outbuf = convert_from_hex_to_uf2(inpbuf.decode("utf-8"))
elif args.carray:
outbuf = convert_to_carray(inpbuf)
ext = "h"
else:
outbuf = convert_to_uf2(inpbuf)
if not args.deploy and not args.info:
print("Converted to %s, output size: %d, start address: 0x%x" %
(ext, len(outbuf), appstartaddr))
if args.convert or ext != "uf2":
if args.output == None:
args.output = "flash." + ext
if args.output:
write_file(args.output, outbuf)
if ext == "uf2" and not args.convert and not args.info:
drives = get_drives()
if len(drives) == 0:
if args.wait:
print("Waiting for drive to deploy...")
while len(drives) == 0:
sleep(0.1)
drives = get_drives()
elif not args.output:
error("No drive to deploy.")
for d in drives:
print("Flashing %s (%s)" % (d, board_id(d)))
write_file(d + "/NEW.UF2", outbuf)
if __name__ == "__main__":
main()
+362
View File
@@ -0,0 +1,362 @@
[
{
"id": "0x16573617",
"short_name": "ATMEGA32",
"description": "Microchip (Atmel) ATmega32"
},
{
"id": "0x1851780a",
"short_name": "SAML21",
"description": "Microchip (Atmel) SAML21"
},
{
"id": "0x1b57745f",
"short_name": "NRF52",
"description": "Nordic NRF52"
},
{
"id": "0x1c5f21b0",
"short_name": "ESP32",
"description": "ESP32"
},
{
"id": "0x1e1f432d",
"short_name": "STM32L1",
"description": "ST STM32L1xx"
},
{
"id": "0x202e3a91",
"short_name": "STM32L0",
"description": "ST STM32L0xx"
},
{
"id": "0x21460ff0",
"short_name": "STM32WL",
"description": "ST STM32WLxx"
},
{
"id": "0x22e0d6fc",
"short_name": "RTL8710B",
"description": "Realtek AmebaZ RTL8710B"
},
{
"id": "0x2abc77ec",
"short_name": "LPC55",
"description": "NXP LPC55xx"
},
{
"id": "0x300f5633",
"short_name": "STM32G0",
"description": "ST STM32G0xx"
},
{
"id": "0x31d228c6",
"short_name": "GD32F350",
"description": "GD32F350"
},
{
"id": "0x3379CFE2",
"short_name": "RTL8720D",
"description": "Realtek AmebaD RTL8720D"
},
{
"id": "0x04240bdf",
"short_name": "STM32L5",
"description": "ST STM32L5xx"
},
{
"id": "0x4c71240a",
"short_name": "STM32G4",
"description": "ST STM32G4xx"
},
{
"id": "0x4fb2d5bd",
"short_name": "MIMXRT10XX",
"description": "NXP i.MX RT10XX"
},
{
"id": "0x51e903a8",
"short_name": "XR809",
"description": "Xradiotech 809"
},
{
"id": "0x53b80f00",
"short_name": "STM32F7",
"description": "ST STM32F7xx"
},
{
"id": "0x55114460",
"short_name": "SAMD51",
"description": "Microchip (Atmel) SAMD51"
},
{
"id": "0x57755a57",
"short_name": "STM32F4",
"description": "ST STM32F4xx"
},
{
"id": "0x5a18069b",
"short_name": "FX2",
"description": "Cypress FX2"
},
{
"id": "0x5d1a0a2e",
"short_name": "STM32F2",
"description": "ST STM32F2xx"
},
{
"id": "0x5ee21072",
"short_name": "STM32F1",
"description": "ST STM32F103"
},
{
"id": "0x621e937a",
"short_name": "NRF52833",
"description": "Nordic NRF52833"
},
{
"id": "0x647824b6",
"short_name": "STM32F0",
"description": "ST STM32F0xx"
},
{
"id": "0x675a40b0",
"short_name": "BK7231U",
"description": "Beken 7231U/7231T"
},
{
"id": "0x68ed2b88",
"short_name": "SAMD21",
"description": "Microchip (Atmel) SAMD21"
},
{
"id": "0x6a82cc42",
"short_name": "BK7251",
"description": "Beken 7251/7252"
},
{
"id": "0x6b846188",
"short_name": "STM32F3",
"description": "ST STM32F3xx"
},
{
"id": "0x6d0922fa",
"short_name": "STM32F407",
"description": "ST STM32F407"
},
{
"id": "0x4e8f1c5d",
"short_name": "STM32H5",
"description": "ST STM32H5xx"
},
{
"id": "0x6db66082",
"short_name": "STM32H7",
"description": "ST STM32H7xx"
},
{
"id": "0x70d16653",
"short_name": "STM32WB",
"description": "ST STM32WBxx"
},
{
"id": "0x7b3ef230",
"short_name": "BK7231N",
"description": "Beken 7231N"
},
{
"id": "0x7eab61ed",
"short_name": "ESP8266",
"description": "ESP8266"
},
{
"id": "0x7f83e793",
"short_name": "KL32L2",
"description": "NXP KL32L2x"
},
{
"id": "0x8fb060fe",
"short_name": "STM32F407VG",
"description": "ST STM32F407VG"
},
{
"id": "0x9fffd543",
"short_name": "RTL8710A",
"description": "Realtek Ameba1 RTL8710A"
},
{
"id": "0xada52840",
"short_name": "NRF52840",
"description": "Nordic NRF52840"
},
{
"id": "0x820d9a5f",
"short_name": "NRF52820",
"description": "Nordic NRF52820_xxAA"
},
{
"id": "0xbfdd4eee",
"short_name": "ESP32S2",
"description": "ESP32-S2"
},
{
"id": "0xc47e5767",
"short_name": "ESP32S3",
"description": "ESP32-S3"
},
{
"id": "0xd42ba06c",
"short_name": "ESP32C3",
"description": "ESP32-C3"
},
{
"id": "0x2b88d29c",
"short_name": "ESP32C2",
"description": "ESP32-C2"
},
{
"id": "0x332726f6",
"short_name": "ESP32H2",
"description": "ESP32-H2"
},
{
"id": "0x540ddf62",
"short_name": "ESP32C6",
"description": "ESP32-C6"
},
{
"id": "0x3d308e94",
"short_name": "ESP32P4",
"description": "ESP32-P4"
},
{
"id": "0xf71c0343",
"short_name": "ESP32C5",
"description": "ESP32-C5"
},
{
"id": "0x77d850c4",
"short_name": "ESP32C61",
"description": "ESP32-C61"
},
{
"id": "0xb6dd00af",
"short_name": "ESP32H21",
"description": "ESP32-H21"
},
{
"id": "0x9e0baa8a",
"short_name": "ESP32H4",
"description": "ESP32-H4"
},
{
"id": "0xde1270b7",
"short_name": "BL602",
"description": "Boufallo 602"
},
{
"id": "0xe08f7564",
"short_name": "RTL8720C",
"description": "Realtek AmebaZ2 RTL8720C"
},
{
"id": "0xe48bff56",
"short_name": "RP2040",
"description": "Raspberry Pi RP2040"
},
{
"id": "0xe48bff57",
"short_name": "RP2XXX_ABSOLUTE",
"description": "Raspberry Pi Microcontrollers: Absolute (unpartitioned) download"
},
{
"id": "0xe48bff58",
"short_name": "RP2XXX_DATA",
"description": "Raspberry Pi Microcontrollers: Data partition download"
},
{
"id": "0xe48bff59",
"short_name": "RP2350_ARM_S",
"description": "Raspberry Pi RP2350, Secure Arm image"
},
{
"id": "0xe48bff5a",
"short_name": "RP2350_RISCV",
"description": "Raspberry Pi RP2350, RISC-V image"
},
{
"id": "0xe48bff5b",
"short_name": "RP2350_ARM_NS",
"description": "Raspberry Pi RP2350, Non-secure Arm image"
},
{
"id": "0x00ff6919",
"short_name": "STM32L4",
"description": "ST STM32L4xx"
},
{
"id": "0x9af03e33",
"short_name": "GD32VF103",
"description": "GigaDevice GD32VF103"
},
{
"id": "0x4f6ace52",
"short_name": "CSK4",
"description": "LISTENAI CSK300x/400x"
},
{
"id": "0x6e7348a8",
"short_name": "CSK6",
"description": "LISTENAI CSK60xx"
},
{
"id": "0x11de784a",
"short_name": "M0SENSE",
"description": "M0SENSE BL702"
},
{
"id": "0x4b684d71",
"short_name": "MaixPlay-U4",
"description": "Sipeed MaixPlay-U4(BL618)"
},
{
"id": "0x9517422f",
"short_name": "RZA1LU",
"description": "Renesas RZ/A1LU (R7S7210xx)"
},
{
"id": "0x2dc309c5",
"short_name": "STM32F411xE",
"description": "ST STM32F411xE"
},
{
"id": "0x06d1097b",
"short_name": "STM32F411xC",
"description": "ST STM32F411xC"
},
{
"id": "0x72721d4e",
"short_name": "NRF52832xxAA",
"description": "Nordic NRF52832xxAA"
},
{
"id": "0x6f752678",
"short_name": "NRF52832xxAB",
"description": "Nordic NRF52832xxAB"
},
{
"id": "0xa0c97b8e",
"short_name": "AT32F415",
"description": "ArteryTek AT32F415"
},
{
"id": "0x699b62ec",
"short_name": "CH32V",
"description": "WCH CH32V2xx and CH32V3xx"
},
{
"id": "0x7be8976d",
"short_name": "RA4M1",
"description": "Renesas RA4M1"
}
]
-919
View File
@@ -1,919 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-terminal-4.8.0">
<meta name="description" content="MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults">
<link rel="canonical" href="https://tth-pub.pages.rfa.cz/meshcore-tth/ble-lora-coexistence/"><link rel="icon" type="image/png" sizes="192x192" href="../img/android-chrome-192x192.png" />
<link rel="icon" type="image/png" sizes="512x512" href="../img/android-chrome-512x512.png" />
<link rel="apple-touch-icon" sizes="180x180" href="../img/apple-touch-icon.png" />
<link rel="shortcut icon" type="image/png" sizes="48x48" href="../img/favicon.ico" />
<link rel="icon" type="image/png" sizes="16x16" href="../img/favicon-16x16.png" />
<link rel="icon" type="image/png" sizes="32x32" href="../img/favicon-32x32.png" />
<title>BLE/LoRa coexistence - MeshCore TTH</title>
<link href="../css/fontawesome/css/fontawesome.min.css" rel="stylesheet">
<link href="../css/fontawesome/css/solid.min.css" rel="stylesheet">
<link href="../css/normalize.css" rel="stylesheet">
<link href="../css/terminal.css" rel="stylesheet">
<link href="../css/theme.css" rel="stylesheet">
<link href="../css/theme.tile_grid.css" rel="stylesheet">
<link href="../css/theme.footer.css" rel="stylesheet">
<!-- dark color palette -->
<link href="../css/palettes/dark.css" rel="stylesheet">
<!-- page layout -->
<style>
/* initially set page layout to a one column grid */
.terminal-mkdocs-main-grid {
display: grid;
grid-column-gap: 1.4em;
grid-template-columns: auto;
grid-template-rows: auto;
}
/*
* when side navigation is not hidden, use a two column grid.
* if the screen is too narrow, fall back to the initial one column grid layout.
* in this case the main content will be placed under the navigation panel.
*/
@media only screen and (min-width: 70em) {
.terminal-mkdocs-main-grid {
grid-template-columns: 4fr 9fr;
}
}</style>
<!-- cursor_animation override -->
<style>
#mkdocs-terminal-site-name.terminal-prompt::after {
display: none;
}
</style>
<link href="../_stylesheets/tth.css" rel="stylesheet">
<!-- search css support -->
<link href="../css/search/bootstrap-modal.css" rel="stylesheet">
<!-- search scripts -->
<script>
var base_url = "..",
shortcuts = "{}";
</script>
<script src="../js/jquery/jquery-1.10.1.min.js" defer></script>
<script src="../js/bootstrap/bootstrap.min.js" defer></script>
<script src="../js/mkdocs/base.js" defer></script>
<script src="../search/main.js"></script>
</head>
<body class="terminal"><div class="container">
<div class="terminal-nav">
<header class="terminal-logo">
<div id="mkdocs-terminal-site-name" class="logo terminal-prompt"><a href="https://tth-pub.pages.rfa.cz/meshcore-tth/" class="no-style">MeshCore TTH</a></div>
</header>
<nav class="terminal-menu">
<ul vocab="https://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
<a href=".." class="menu-item " property="item" typeof="WebPage">
<span property="name">About the fork</span>
</a>
<meta property="position" content="0">
</li>
<li property="itemListElement" typeof="ListItem">
<a href="../cs/" class="menu-item " property="item" typeof="WebPage">
<span property="name">Česky</span>
</a>
<meta property="position" content="1">
</li>
<li property="itemListElement" typeof="ListItem">
<a href="#" class="menu-item" data-toggle="modal" data-target="#mkdocs_search_modal" property="item" typeof="SearchAction">
<i aria-hidden="true" class="fa fa-search"></i> <span property="name">Search</span>
</a>
<meta property="position" content="2">
</li>
</ul>
</nav>
</div>
</div>
<div class="container">
<div class="terminal-mkdocs-main-grid"><aside id="terminal-mkdocs-side-panel"><nav>
<ul class="terminal-mkdocs-side-nav-items">
<li class="terminal-mkdocs-side-nav-li">
<a class="terminal-mkdocs-side-nav-item" href="..">About the fork</a>
</li>
<li class="terminal-mkdocs-side-nav-li">
<a class="terminal-mkdocs-side-nav-item" href="../cs/">Česky</a>
</li>
<li class="terminal-mkdocs-side-nav-li">
<span class="
terminal-mkdocs-side-nav-item--active terminal-mkdocs-side-nav-section-no-index">Fork meshcore-tth</span>
<ul class="terminal-mkdocs-side-nav-li-ul">
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../tth-commands/">Console commands</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../ota/">Firmware update by the admin (OTA)</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../power/">Power saving</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../budka-sensor/">Budka as a sensor</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<span class="terminal-mkdocs-side-nav-item--active">BLE/LoRa coexistence</span>
</li>
</ul>
</li>
<li class="terminal-mkdocs-side-nav-li">
<span class="
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">MeshCore (upstream)</span>
<ul class="terminal-mkdocs-side-nav-li-ul">
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../meshcore/">Introduction</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../faq/">FAQ</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../cli_commands/">CLI commands</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../companion_cli/">Companion CLI</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../companion_protocol/">Companion protocol</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../terminal_chat_cli/">Terminal chat CLI</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../kiss_modem_protocol/">KISS modem protocol</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../packet_format/">Packet format</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../payloads/">Payloads</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../stats_binary_frames/">Stats binary frames</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../number_allocations/">Number allocations</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../qr_codes/">QR codes</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../radio_presets/">Radio presets</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../nrf52_power_management/">nRF52 power management</a>
</li>
</ul>
</li>
</ul>
</nav><hr>
<nav>
<ul>
<li><a href="#blelora-coexistence-bench-reproduction-attempt">BLE/LoRa coexistence — bench reproduction attempt</a></li>
<li><a href="#the-claim-under-test">The claim under test</a></li><li><a href="#rig">Rig</a></li><li><a href="#what-was-measured">What was measured</a></li><li><a href="#on-mast-hardware-with-the-file-log-on">On mast hardware, with the file log on</a></li><li><a href="#still-open">Still open</a></li><li><a href="#airtime-is-a-hard-limit-and-the-firmware-will-not-enforce-it">Airtime is a hard limit, and the firmware will not enforce it</a></li><li><a href="#traps-worth-remembering">Traps worth remembering</a></li><li><a href="#the-two-commands-this-bench-added">The two commands this bench added</a></li>
</ul>
</nav>
</aside>
<main id="terminal-mkdocs-main-content">
<section id="mkdocs-terminal-content">
<h1 id="blelora-coexistence-bench-reproduction-attempt">BLE/LoRa coexistence — bench reproduction attempt</h1>
<p>Working notes for the DIRECT-forward loss seen on <code>mast-three</code> (SenseCap Solar,
<code>SenseCap_Solar_repeater_ble</code>). Written down because the result is mostly
<strong>negative</strong>, and a negative result is only worth anything if the method and its
limits are recorded with it.</p>
<h2 id="the-claim-under-test">The claim under test</h2>
<p>Commit <code>f6e9aeca</code> widened the BLE connection interval from 15–30 ms to 60–80 ms
after an A/B on the mast showed ~40 % of DIRECT-route forwards silently lost
with an <strong>idle</strong> BLE connection at 15–30 ms. The stated mechanism is that the
SoftDevice's per-connection-event preemption disturbs the SX126x TX path
(<code>startTransmit</code> fail / send-complete timeout).</p>
<p>The fix is deployed. What was never established is whether a bench rig can
<strong>detect</strong> the effect at all — a measurement that reads zero in both the
treatment and the control has shown nothing.</p>
<h2 id="rig">Rig</h2>
<p>Isolated test mesh on <strong>866.5 MHz</strong> (BW 62.5, SF 8, CR 5). Isolation is by
frequency, not by tx power: a hilltop repeater with <code>RX_BOOSTED_GAIN</code> hears a
few mW just fine. The override is compile-time (<code>platformio.local.ini</code>) because
<code>MyMesh.cpp</code> seeds <code>_prefs.freq</code> from <code>LORA_FREQ</code>, so the firmware cannot come
up on the production frequency even after <code>erase</code>.</p>
<table>
<thead>
<tr>
<th>node</th>
<th>board</th>
<th>role</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>bench-board</code></td>
<td>XIAO nRF52840 + Wio-SX1262</td>
<td>forwarder under test</td>
</tr>
<tr>
<td><code>bench-board</code></td>
<td>same</td>
<td>paired control / radiating witness</td>
</tr>
<tr>
<td><code>bench-board</code>, <code>bench-board</code></td>
<td>same</td>
<td>probe sources</td>
</tr>
<tr>
<td><code>bench-rpt</code></td>
<td>SenseCap Solar Node</td>
<td>forwarder, mast-identical hardware</td>
</tr>
<tr>
<td><code>tth-s2-rpt</code></td>
<td>same</td>
<td>paired control</td>
</tr>
</tbody>
</table>
<p>Paired controls differ <strong>only</strong> in <code>ADVERT_NAME</code>, verified by diffing strings in
the ELF. Any other difference invalidates them.</p>
<h3 id="oracle">Oracle</h3>
<p>The measured quantity is the node's own <code>direct_rx − direct_tx</code> from
<code>stats-packets</code>: how many DIRECT packets it accepted for forwarding versus how
many it actually sent. This is self-normalising — it does not depend on channel
conditions or on a receiver hearing anything. <code>tx_start_fail</code> and <code>tx_timeout</code>
are the mechanism-level counters. A second repeater with <code>repeat off</code> acts as a
radiating witness, so "counted a TX" can be distinguished from "actually
radiated".</p>
<p>Route forcing: a contact is injected into the sender's companion with an
explicit <code>out_path</code>, so the DM must traverse the node under test.
<strong><code>out_path_len</code> is not a hop count</strong> — it is a packed byte, top two bits =
hash size − 1, low six = hop count (<code>Packet.h:85</code>). One hop with a 2-byte hash
is <code>0x41</code>, not <code>1</code>. The receiver reads the size out of the packet
(<code>Mesh.cpp:93</code>), so a forced path works regardless of the node's
<code>path.hash.mode</code>.</p>
<h2 id="what-was-measured">What was measured</h2>
<p>All cells at a <strong>verified</strong> 22.50 ms connection interval — <code>bleconn</code> reports the
parameters actually negotiated, because <code>bleOnSecured()</code> only requests them and
the central may refuse. Without that read-back none of the null results below
would mean anything.</p>
<table>
<thead>
<tr>
<th style="text-align: right;"><code>blepwr</code></th>
<th style="text-align: right;">≈RSSI at central</th>
<th style="text-align: right;">link up</th>
<th style="text-align: right;">direct_rx</th>
<th style="text-align: right;">direct_tx</th>
<th style="text-align: right;">lost</th>
<th style="text-align: right;">tx_timeout</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: right;">BLE off</td>
<td style="text-align: right;">—</td>
<td style="text-align: right;">—</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">0</td>
</tr>
<tr>
<td style="text-align: right;">0 dBm</td>
<td style="text-align: right;">−67</td>
<td style="text-align: right;">100 %</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">0</td>
</tr>
<tr>
<td style="text-align: right;">−8</td>
<td style="text-align: right;">−75</td>
<td style="text-align: right;">100 %</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">0</td>
</tr>
<tr>
<td style="text-align: right;">−12</td>
<td style="text-align: right;">−79</td>
<td style="text-align: right;">100 %</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">0</td>
</tr>
<tr>
<td style="text-align: right;">−16</td>
<td style="text-align: right;">−83</td>
<td style="text-align: right;">87 %</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">0</td>
</tr>
<tr>
<td style="text-align: right;">−20</td>
<td style="text-align: right;">−87</td>
<td style="text-align: right;">27 %</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">0</td>
</tr>
</tbody>
</table>
<p>The −20 dBm row is a bonus condition: the link held only a quarter of the
window, so the node spent the rest advertising and re-connecting — close to the
reconnect churn the mast reports as HCI 0x3E.</p>
<p><strong>Ruled out as the missing factor: BLE link margin.</strong> The whole −75..−90 window
the mast sits in is covered, at the known-bad interval, with zero loss.</p>
<h3 id="why-idle-weak-link-does-nothing">Why idle + weak link does nothing</h3>
<p>In idle the connection events carry empty PDUs, whose retransmission costs
almost no radio time. The cost of a retransmission scales with payload size, and
the mast has a bridge actively draining the console. Hence the <code>poll</code> mode in
the harness.</p>
<p>Direction matters too, and it is the reason to weaken <strong>our</strong> side rather than
the central's: a connection event ends as soon as either side misses a packet,
so if the central misses our PDU we must re-send it at the next anchor — an
extra slave TX. If we miss the central's PDU we never transmit in that event at
all, and the SoftDevice uses <em>less</em> radio.</p>
<h2 id="on-mast-hardware-with-the-file-log-on">On mast hardware, with the file log on</h2>
<p>Two SenseCap Solar nodes (<code>bench-rpt</code> forwarder, <code>tth-s2-rpt</code> paired control) —
the same board as the mast, so InternalFS logging, INA226/solar telemetry and
the SenseCap SPI layout are all in play. Again at a verified 22.50 ms interval
(<code>bleconn</code>).</p>
<table>
<thead>
<tr>
<th>file log</th>
<th>BLE</th>
<th style="text-align: right;">direct_rx</th>
<th style="text-align: right;">direct_tx</th>
<th style="text-align: right;">lost</th>
<th style="text-align: right;">tx_timeout</th>
<th style="text-align: right;">witness</th>
</tr>
</thead>
<tbody>
<tr>
<td>off</td>
<td>off</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">+39</td>
</tr>
<tr>
<td>off</td>
<td>idle, 88 % of window</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">+37</td>
</tr>
<tr>
<td><strong>on</strong></td>
<td>off</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">+39</td>
</tr>
<tr>
<td><strong>on</strong></td>
<td>idle, 90 % of window</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">8</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">0</td>
<td style="text-align: right;">+40</td>
</tr>
</tbody>
</table>
<p>The logging condition was real, not nominal: <code>log</code> afterwards held 69 entries
with RX/TX lines timestamped inside the measurement window, i.e. an InternalFS
write per packet — the mechanism behind the known deaf windows.</p>
<p><strong>Ten cells, 80 forced forwards, zero lost, <code>tx_timeout</code> and <code>tx_start_fail</code> at
zero throughout.</strong> Against the mast's reported ~40 % loss rate this is not a
weak null: a single 8-probe cell would miss a true 40 % effect with probability
0.6⁸ ≈ 1.7 %, and ten cells make it vanishing. Whatever the mast is doing, it is
not reproduced by the connection interval, the BLE link margin, the board, or
InternalFS logging — alone or together.</p>
<h2 id="still-open">Still open</h2>
<p><strong>Loaded LoRa channel</strong> is the one uncontrolled difference left. Ours is idle;
the mast relays flood traffic, so its forwards contend for a busy channel and
the TX window lands on a BLE connection event far more often. This cannot be
tested legally here: 866.5 is capped at 1 % duty and the 10 % sub-band
(869.4–869.65) is where production lives.</p>
<p>Practical consequence: <strong>f6e9aeca can be neither confirmed nor refuted on the
bench.</strong> Deciding whether the 60–80 ms interval is still needed requires
measuring on <code>mast-three</code> itself — the counters (<code>stats-packets</code>, and now
<code>bleconn</code> to prove which interval is actually in force) are all reachable over
its BLE console.</p>
<h2 id="airtime-is-a-hard-limit-and-the-firmware-will-not-enforce-it">Airtime is a hard limit, and the firmware will not enforce it</h2>
<p>866.5 MHz sits in 865–868 (CZ VO-R/10): 25 mW ERP, <strong>1 % duty cycle = 36 s of
transmission per hour</strong>. The firmware does not police this — <code>airtime_factor</code>
defaults to 0 (= 100 %) and is clamped to 9, so the lowest duty MeshCore can
enforce is 10 %. The first sweep consumed <code>tx_air_secs</code> 27 s in 18 minutes of
uptime, a rate of ~2.5 %. Budget the probes: <code>stats-radio.tx_air_secs</code> is the
ground truth, and the harness aborts before crossing a configured cap.</p>
<p><code>stats-core.queue_len</code> and <code>errors</code> are a required control, not decoration: when
the airtime budget runs out the Dispatcher <strong>defers</strong> a forward
(<code>next_tx_time</code>, <code>Dispatcher.cpp:101</code>), which looks identical to loss in the
counters. Both were zero throughout.</p>
<h2 id="traps-worth-remembering">Traps worth remembering</h2>
<ul>
<li><strong>USB and BLE consoles share one <code>command[160]</code>.</strong> Two concurrent consoles
interleave into one line and crash the node. The harness keeps a strict
sequence: counters over USB → close USB → BLE client → probes → stop BLE →
counters over USB.</li>
<li><strong><code>Bluefruit.setTxPower()</code> is advertising-only</strong> (see the commit message for
<code>blepwr</code>); the connection runs at the SoftDevice default 0 dBm.</li>
<li><strong>Weakening the link can lock you out of BLE.</strong> Below about −16 dBm the
node's replies stop arriving and the value is re-applied on every reconnect
(and, since 6. 10. 2026, saved). The way back is <code>blepwr</code> over the mesh admin
CLI.</li>
<li><strong>~~Runtime <code>set tx</code> does not change radiated LoRa power~~ — retracted.</strong> The
original reading (+2 dBm → RSSI −44.1, −9 dBm → −44.0) was made with an
instrument that could not report failure: <code>RadioLibWrapper::setTxPower()</code>
discarded RadioLib's status, so a refused request looked exactly like an
accepted one. Re-measured 2026-08-04 on the repeater build with <code>txpwr</code>
confirming each step, x1 transmitting and x4 as witness:</li>
</ul>
<table>
<thead>
<tr>
<th style="text-align: right;"><code>txpwr</code></th>
<th style="text-align: right;">witness <code>last_rssi</code></th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: right;">+22</td>
<td style="text-align: right;">0 dBm <em>(saturated)</em></td>
</tr>
<tr>
<td style="text-align: right;">+14</td>
<td style="text-align: right;">−1 dBm <em>(saturated)</em></td>
</tr>
<tr>
<td style="text-align: right;">+6</td>
<td style="text-align: right;">−7 dBm</td>
</tr>
<tr>
<td style="text-align: right;">0</td>
<td style="text-align: right;">−18 dBm</td>
</tr>
<tr>
<td style="text-align: right;">−9</td>
<td style="text-align: right;">−28 dBm</td>
</tr>
</tbody>
</table>
<p>31 dB of command produced 28 dB of RSSI, and the witness <code>recv</code> counter rose
by one at every step, so no point was missed. Radiated power does follow the
setting. The top two points are saturated — the boards were ~10 cm apart — so
the usable range of that particular rig starts around +6 dBm; characterising
the top end needs attenuation or distance, not a bigger number.</p>
<p>The lesson is not about tx power. It is that a null result from an instrument
which cannot distinguish "refused" from "no effect" is not a result at all.</p>
<h2 id="the-two-commands-this-bench-added">The two commands this bench added</h2>
<p>Both live in <code>examples/simple_repeater/main.cpp</code> and are repeater-only.</p>
<h3 id="bleconn-what-the-link-is-actually-doing"><code>bleconn</code> — what the link is actually doing</h3>
<div class="highlight"><pre><span></span><code>bleconn
-&gt; BLE conn: interval 75.00 ms (req 60-80), latency 0, sup timeout 4000 ms [live]
</code></pre></div>
<p>Reports the <strong>negotiated</strong> connection parameters, not the requested ones. The
central is free to ignore a peripheral's request, so this is the only way to
know whether a change like <code>f6e9aeca</code> (widening the requested interval to
60–80 ms) is in force on a node you cannot see. The trailing <code>[live]</code> /
<code>[last]</code> says whether a client is connected right now or these are the values
from the last one; before any client has ever connected it answers
<code>nothing seen yet</code>.</p>
<h3 id="blepwr-dbm-connection-tx-power-saved"><code>blepwr [dBm]</code> — connection TX power, saved</h3>
<div class="highlight"><pre><span></span><code>blepwr # report: BLE conn tx: 0 dBm, adv tx: 8 dBm
blepwr 8 # set, apply to live connections and save
blepwr default # forget the saved value, back to RPT_BLE_CONN_TX_POWER
</code></pre></div>
<p>The reply carries how many live connections accepted the value
(<code>OK - BLE conn tx 8 dBm (1/1 conn), saved</code>) because the nRF52840 only takes
−40, −20, −16, −12, −8, −4, 0 and 2..8 dBm; anything else is rejected and is
<em>not</em> latched or saved, so a typo cannot arm itself for the next reconnect.
The value lives in <code>/ble_pwr</code> in InternalFS, so it survives a reboot and also a
reflash with a different build default: an explicit value is pinned even when
it equals the default (no file = follow <code>RPT_BLE_CONN_TX_POWER</code>, which
mast-three's env sets to 8).</p>
<p>Sets <code>BLE_GAP_TX_POWER_ROLE_CONN</code>, which is <strong>independent of</strong>
<code>Bluefruit.setTxPower()</code> — that one only affects advertising, despite reading
like a global. The connection otherwise runs at the SoftDevice default of
0 dBm; the compile-time starting value is <code>RPT_BLE_CONN_TX_POWER</code>.</p>
<p>The value is re-applied on every 'secured' event and saved, so a setting weak
enough to break the link persists across reconnects and reboots — at −40 dBm
during this bench it locked the BLE console out. Fix it over the mesh admin
CLI (<code>blepwr 0</code>), which does not depend on BLE. Until 6. 10. 2026 a weakening
auto-reverted after 5 minutes and nothing was saved; that went away once the
value started to be saved, because a revert that the next reboot undoes again
only made the state harder to read.</p>
</section>
</main>
</div>
<hr><footer>
<div class="terminal-mkdocs-footer-grid">
<div id="terminal-mkdocs-footer-copyright-info">
Site built with <a href="http://www.mkdocs.org">MkDocs</a> and <a href="https://github.com/ntno/mkdocs-terminal">Terminal for MkDocs</a>.
</div>
</div>
</footer>
</div>
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="alertdialog" aria-modal="true" aria-labelledby="searchModalLabel">
<div class="modal-dialog modal-lg" role="search">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="searchModalLabel">Search</h5>
<button type="button" class="close btn btn-default btn-ghost" data-dismiss="modal" aria-label="Close">x</button>
</div>
<div class="modal-body">
<p id="searchInputLabel">Type to start searching</p>
<form>
<div class="form-group">
<input type="search" class="form-control" aria-labelledby="searchInputLabel" placeholder="" id="mkdocs-search-query" title="Please enter search terms here">
</div>
</form>
<div id="mkdocs-search-results" data-no-results-text="No document matches found"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>
+61
View File
@@ -0,0 +1,61 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [
["0x239A","0x8029"],
["0x239A","0x0029"],
["0x239A","0x002A"],
["0x239A","0x802A"]
],
"usb_product": "HT-n5262",
"mcu": "nrf52840",
"variant": "Heltec_T114_Board",
"bsp": {
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS140",
"sd_name": "s140",
"sd_version": "6.1.1",
"sd_fwid": "0x00B6"
},
"bootloader": {
"settings_addr": "0xFF000"
}
},
"connectivity": [
"bluetooth"
],
"debug": {
"jlink_device": "nRF52840_xxAA",
"svd_path": "nrf52840.svd",
"openocd_target": "nrf52.cfg"
},
"frameworks": [
"arduino"
],
"name": "Heltec T114 Board",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"speed": 115200,
"protocol": "nrfutil",
"protocols": [
"jlink",
"nrfjprog",
"nrfutil",
"stlink"
],
"use_1200bps_touch": true,
"require_upload_port": true,
"wait_for_upload_port": true
},
"url": "https://heltec.org/",
"vendor": "Heltec"
}
+72
View File
@@ -0,0 +1,72 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [
[
"0x239A",
"0x8029"
],
[
"0x239A",
"0x0029"
],
[
"0x239A",
"0x002A"
],
[
"0x239A",
"0x802A"
]
],
"usb_product": "BQ nRF52840",
"mcu": "nrf52840",
"variant": "nano-g2-ultra",
"bsp": {
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS140",
"sd_name": "s140",
"sd_version": "6.1.1",
"sd_fwid": "0x00B6"
},
"bootloader": {
"settings_addr": "0xFF000"
}
},
"connectivity": [
"bluetooth"
],
"debug": {
"jlink_device": "nRF52840_xxAA",
"svd_path": "nrf52840.svd"
},
"frameworks": [
"arduino"
],
"name": "BQ nRF52840",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"speed": 115200,
"protocol": "nrfutil",
"protocols": [
"jlink",
"nrfjprog",
"nrfutil",
"stlink"
],
"use_1200bps_touch": true,
"require_upload_port": true,
"wait_for_upload_port": true
},
"url": "https://wiki.uniteng.com/en/meshtastic/nano-g2-ultra",
"vendor": "BQ Consulting"
}
+38
View File
@@ -0,0 +1,38 @@
/* Linker script to configure memory regions. */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x26000, LENGTH = 0xED000 - 0x26000
/* SRAM required by Softdevice depend on
* - Attribute Table Size (Number of Services and Characteristics)
* - Vendor UUID count
* - Max ATT MTU
* - Concurrent connection peripheral + central + secure links
* - Event Len, HVN queue, Write CMD queue
*/
RAM (rwx) : ORIGIN = 0x20006000, LENGTH = 0x20040000 - 0x20006000
}
SECTIONS
{
. = ALIGN(4);
.svc_data :
{
PROVIDE(__start_svc_data = .);
KEEP(*(.svc_data))
PROVIDE(__stop_svc_data = .);
} > RAM
.fs_data :
{
PROVIDE(__start_fs_data = .);
KEEP(*(.fs_data))
PROVIDE(__stop_fs_data = .);
} > RAM
} INSERT AFTER .data;
INCLUDE "nrf52_common.ld"
+38
View File
@@ -0,0 +1,38 @@
/* Linker script to configure memory regions. */
SEARCH_DIR(.)
GROUP(-lgcc -lc -lnosys)
MEMORY
{
FLASH (rx) : ORIGIN = 0x27000, LENGTH = 0xED000 - 0x27000
/* SRAM required by Softdevice depend on
* - Attribute Table Size (Number of Services and Characteristics)
* - Vendor UUID count
* - Max ATT MTU
* - Concurrent connection peripheral + central + secure links
* - Event Len, HVN queue, Write CMD queue
*/
RAM (rwx) : ORIGIN = 0x20006000, LENGTH = 0x20040000 - 0x20006000
}
SECTIONS
{
. = ALIGN(4);
.svc_data :
{
PROVIDE(__start_svc_data = .);
KEEP(*(.svc_data))
PROVIDE(__stop_svc_data = .);
} > RAM
.fs_data :
{
PROVIDE(__start_fs_data = .);
KEEP(*(.fs_data))
PROVIDE(__stop_fs_data = .);
} > RAM
} INSERT AFTER .data;
INCLUDE "nrf52_common.ld"
+79
View File
@@ -0,0 +1,79 @@
{
"build": {
"arduino":{
"ldscript": "nrf52840_s140_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_FEATHER -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [
[
"0x239A",
"0x00B3"
],
[
"0x239A",
"0x8029"
],
[
"0x239A",
"0x0029"
],
[
"0x239A",
"0x002A"
],
[
"0x239A",
"0x802A"
]
],
"usb_product": "ProMicro NRF52840",
"mcu": "nrf52840",
"variant": "promicro_nrf52840",
"variants_dir": "variants",
"bsp": {
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS140",
"sd_name": "s140",
"sd_version": "6.1.1",
"sd_fwid": "0x00B6"
},
"bootloader": {
"settings_addr": "0xFF000"
}
},
"connectivity": [
"bluetooth"
],
"debug": {
"jlink_device": "nRF52840_xxAA",
"svd_path": "nrf52840.svd",
"openocd_target": "nrf52.cfg"
},
"frameworks": [
"arduino",
"zephyr"
],
"name": "ProMicro NRF52840",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"speed": 115200,
"protocol": "nrfutil",
"protocols": [
"jlink",
"nrfjprog",
"nrfutil",
"stlink"
],
"use_1200bps_touch": true,
"require_upload_port": true,
"wait_for_upload_port": true
},
"url": "https://www.nologo.tech/en/product/otherboard/NRF52840.html",
"vendor": "Nologo"
}
+33
View File
@@ -0,0 +1,33 @@
{
"build": {
"arduino": {
"variant_h": "variant_RAK3172_MODULE.h"
},
"core": "stm32",
"cpu": "cortex-m4",
"extra_flags": "-DSTM32WL -DSTM32WLxx -DSTM32WLE5xx",
"framework_extra_flags": {
"arduino": "-DUSE_CM4_STARTUP_FILE -DARDUINO_RAK3172_MODULE"
},
"f_cpu": "48000000L",
"mcu": "stm32wle5ccu",
"product_line": "STM32WLE5xx",
"variant": "STM32WLxx/WL54CCU_WL55CCU_WLE4C(8-B-C)U_WLE5C(8-B-C)U"
},
"debug": {
"default_tools": ["stlink"],
"jlink_device": "STM32WLE5CC",
"openocd_target": "stm32wlx",
"svd_path": "STM32WLE5_CM4.svd"
},
"frameworks": ["arduino"],
"name": "BB-STM32WL",
"upload": {
"maximum_ram_size": 65536,
"maximum_size": 262144,
"protocol": "stlink",
"protocols": ["stlink", "jlink"]
},
"url": "https://store.rakwireless.com/products/wisduo-lpwan-module-rak3172",
"vendor": "RAK"
}
@@ -0,0 +1,61 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v7.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_Seeed_XIAO_nRF52840 -DNRF52840_XXAA -DSEEED_XIAO_NRF52840 ",
"f_cpu": "64000000L",
"hwids": [
[ "0x2886", "0x8044" ],
[ "0x2886", "0x0044" ]
],
"mcu": "nrf52840",
"variant": "Seeed_XIAO_nRF52840",
"softdevice": {
"sd_flags": "-DS140",
"sd_name": "s140",
"sd_version": "7.3.0",
"sd_fwid": "0x0123"
},
"bsp": {
"name": "adafruit"
},
"bootloader": {
"settings_addr": "0xFF000"
},
"usb_product": "XIAO nRF52840"
},
"connectivity": [
"bluetooth"
],
"debug": {
"jlink_device": "nRF52840_xxAA",
"openocd_target": "nrf52.cfg",
"svd_path": "nrf52840.svd"
},
"frameworks": [
"arduino"
],
"name": "Seeed Studio XIAO nRF52840",
"upload": {
"maximum_ram_size": 237568,
"maximum_size": 811008,
"protocol": "nrfutil",
"speed": 115200,
"protocols": [
"jlink",
"nrfjprog",
"nrfutil",
"cmsis-dap",
"sam-ba",
"blackmagic"
],
"use_1200bps_touch": true,
"require_upload_port": true,
"wait_for_upload_port": true
},
"url": "https://wiki.seeedstudio.com/XIAO_BLE",
"vendor": "Seeed Studio"
}
+43
View File
@@ -0,0 +1,43 @@
{
"build": {
"arduino": {
"ldscript": "esp32s3_out.ld",
"memory_type": "qio_opi"
},
"core": "esp32",
"extra_flags": [
"-DBOARD_HAS_PSRAM",
"-DARDUINO_USB_CDC_ON_BOOT=1",
"-DARDUINO_USB_MODE=0",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=0"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [["0x303A", "0x1001"]],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": [
"wifi"
],
"debug": {
"default_tool": "esp-builtin",
"onboard_tools": ["esp-builtin"],
"openocd_target": "esp32s3.cfg"
},
"frameworks": ["arduino", "espidf"],
"name": "BQ Station G2",
"upload": {
"flash_size": "16MB",
"maximum_ram_size": 327680,
"maximum_size": 16777216,
"use_1200bps_touch": true,
"wait_for_upload_port": true,
"require_upload_port": true,
"speed": 921600
},
"url": "https://wiki.uniteng.com/en/meshtastic/station-g2",
"vendor": "BQ Consulting"
}
+63
View File
@@ -0,0 +1,63 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_PCA10056 -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [
[
"0x239A",
"0x8029"
]
],
"usb_product": "NRF52 DK",
"mcu": "nrf52840",
"variant": "pca10056",
"bsp": {
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS140",
"sd_name": "s140",
"sd_version": "6.1.1",
"sd_fwid": "0x00B6"
},
"bootloader": {
"settings_addr": "0xFF000"
}
},
"connectivity": [
"bluetooth"
],
"debug": {
"jlink_device": "nRF52840_xxAA",
"onboard_tools": [
"jlink"
],
"svd_path": "nrf52840.svd",
"openocd_target": "nrf52.cfg"
},
"frameworks": [
"arduino"
],
"name": "LilyGo T-ECHO",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"require_upload_port": true,
"speed": 115200,
"protocol": "jlink",
"protocols": [
"jlink",
"nrfjprog",
"stlink",
"cmsis-dap",
"blackmagic"
]
},
"url": "https://os.mbed.com/platforms/Nordic-nRF52840-DK/",
"vendor": "Nordic"
}
+45
View File
@@ -0,0 +1,45 @@
{
"build": {
"arduino": {
"ldscript": "esp32s3_out.ld",
"partitions": "default.csv",
"memory_type": "qio_qspi"
},
"core": "esp32",
"extra_flags": [
"-DARDUINO_LILYGO_T3_S3_V1_X",
"-DBOARD_HAS_PSRAM",
"-DARDUINO_USB_CDC_ON_BOOT=1",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1",
"-DARDUINO_USB_MODE=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": [
"wifi"
],
"debug": {
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "LilyGo T3-S3 Radio",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"use_1200bps_touch": true,
"wait_for_upload_port": true,
"require_upload_port": true,
"speed": 460800
},
"url": "https://www.lilygo.cc",
"vendor": "LilyGo"
}
+51
View File
@@ -0,0 +1,51 @@
{
"build": {
"arduino":{
"ldscript": "esp32s3_out.ld",
"partitions": "default.csv",
"memory_type": "qio_qspi"
},
"core": "esp32",
"extra_flags": [
"-DARDUINO_USB_MODE=1",
"-DARDUINO_USB_CDC_ON_BOOT=1",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1"
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
"hwids": [
[
"0x303A",
"0x1001"
]
],
"mcu": "esp32s3",
"variant": "esp32s3"
},
"connectivity": [
"wifi"
],
"debug": {
"default_tool": "esp-builtin",
"onboard_tools": [
"esp-builtin"
],
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
"arduino",
"espidf"
],
"name": "LilyGo T-Beam supreme (8MB Flash 8MB PSRAM)",
"upload": {
"flash_size": "8MB",
"maximum_ram_size": 327680,
"maximum_size": 8388608,
"require_upload_port": true,
"speed": 460800
},
"url": "https://www.lilygo.cc/products/t-beamsupreme-m",
"vendor": "LilyGo"
}
+72
View File
@@ -0,0 +1,72 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v6.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_NRF52840_TTGO_EINK -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [
[
"0x239A",
"0x4405"
],
[
"0x239A",
"0x0029"
],
[
"0x239A",
"0x002A"
]
],
"usb_product": "elecrow_eink",
"mcu": "nrf52840",
"variant": "ELECROW-ThinkNode-M1",
"bsp": {
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS140",
"sd_name": "s140",
"sd_version": "6.1.1",
"sd_fwid": "0x00B6"
},
"bootloader": {
"settings_addr": "0xFF000"
}
},
"connectivity": [
"bluetooth"
],
"debug": {
"jlink_device": "nRF52840_xxAA",
"onboard_tools": [
"jlink"
],
"svd_path": "nrf52840.svd",
"openocd_target": "nrf52.cfg"
},
"frameworks": [
"arduino"
],
"name": "elecrow eink",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"speed": 115200,
"use_1200bps_touch": true,
"require_upload_port": true,
"wait_for_upload_port": true,
"protocol": "nrfutil",
"protocols": [
"jlink",
"nrfjprog",
"nrfutil",
"stlink"
]
},
"url": "https://github.com/Elecrow-RD",
"vendor": "ELECROW"
}
+59
View File
@@ -0,0 +1,59 @@
{
"build": {
"arduino": {
"ldscript": "nrf52840_s140_v7.ld"
},
"core": "nRF5",
"cpu": "cortex-m4",
"extra_flags": "-DARDUINO_WIO_WM1110 -DNRF52840_XXAA",
"f_cpu": "64000000L",
"hwids": [
["0x239A", "0x8029"],
["0x239A", "0x0029"],
["0x239A", "0x002A"],
["0x239A", "0x802A"]
],
"usb_product": "T1000-E-BOOT",
"mcu": "nrf52840",
"variant": "Seeed_T1000-E",
"bsp": {
"name": "adafruit"
},
"softdevice": {
"sd_flags": "-DS140",
"sd_name": "s140",
"sd_version": "7.3.0",
"sd_fwid": "0x0123"
},
"bootloader": {
"settings_addr": "0xFF000"
}
},
"connectivity": ["bluetooth"],
"debug": {
"jlink_device": "nRF52840_xxAA",
"svd_path": "nrf52840.svd",
"openocd_target": "nrf52.cfg"
},
"frameworks": ["arduino"],
"name": "Seeed T1000-E",
"upload": {
"maximum_ram_size": 248832,
"maximum_size": 815104,
"speed": 115200,
"protocol": "nrfutil",
"protocols": [
"jlink",
"nrfjprog",
"nrfutil",
"stlink",
"cmsis-dap",
"blackmagic"
],
"use_1200bps_touch": true,
"require_upload_port": true,
"wait_for_upload_port": true
},
"url": "https://www.seeedstudio.com/SenseCAP-Card-Tracker-T1000-E-for-Meshtastic-p-5913.html",
"vendor": "Seeed Studio"
}
-640
View File
@@ -1,640 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-terminal-4.8.0">
<meta name="description" content="MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults">
<link rel="canonical" href="https://tth-pub.pages.rfa.cz/meshcore-tth/budka-sensor/"><link rel="icon" type="image/png" sizes="192x192" href="../img/android-chrome-192x192.png" />
<link rel="icon" type="image/png" sizes="512x512" href="../img/android-chrome-512x512.png" />
<link rel="apple-touch-icon" sizes="180x180" href="../img/apple-touch-icon.png" />
<link rel="shortcut icon" type="image/png" sizes="48x48" href="../img/favicon.ico" />
<link rel="icon" type="image/png" sizes="16x16" href="../img/favicon-16x16.png" />
<link rel="icon" type="image/png" sizes="32x32" href="../img/favicon-32x32.png" />
<title>Budka as a sensor - MeshCore TTH</title>
<link href="../css/fontawesome/css/fontawesome.min.css" rel="stylesheet">
<link href="../css/fontawesome/css/solid.min.css" rel="stylesheet">
<link href="../css/normalize.css" rel="stylesheet">
<link href="../css/terminal.css" rel="stylesheet">
<link href="../css/theme.css" rel="stylesheet">
<link href="../css/theme.tile_grid.css" rel="stylesheet">
<link href="../css/theme.footer.css" rel="stylesheet">
<!-- dark color palette -->
<link href="../css/palettes/dark.css" rel="stylesheet">
<!-- page layout -->
<style>
/* initially set page layout to a one column grid */
.terminal-mkdocs-main-grid {
display: grid;
grid-column-gap: 1.4em;
grid-template-columns: auto;
grid-template-rows: auto;
}
/*
* when side navigation is not hidden, use a two column grid.
* if the screen is too narrow, fall back to the initial one column grid layout.
* in this case the main content will be placed under the navigation panel.
*/
@media only screen and (min-width: 70em) {
.terminal-mkdocs-main-grid {
grid-template-columns: 4fr 9fr;
}
}</style>
<!-- cursor_animation override -->
<style>
#mkdocs-terminal-site-name.terminal-prompt::after {
display: none;
}
</style>
<link href="../_stylesheets/tth.css" rel="stylesheet">
<!-- search css support -->
<link href="../css/search/bootstrap-modal.css" rel="stylesheet">
<!-- search scripts -->
<script>
var base_url = "..",
shortcuts = "{}";
</script>
<script src="../js/jquery/jquery-1.10.1.min.js" defer></script>
<script src="../js/bootstrap/bootstrap.min.js" defer></script>
<script src="../js/mkdocs/base.js" defer></script>
<script src="../search/main.js"></script>
</head>
<body class="terminal"><div class="container">
<div class="terminal-nav">
<header class="terminal-logo">
<div id="mkdocs-terminal-site-name" class="logo terminal-prompt"><a href="https://tth-pub.pages.rfa.cz/meshcore-tth/" class="no-style">MeshCore TTH</a></div>
</header>
<nav class="terminal-menu">
<ul vocab="https://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
<a href=".." class="menu-item " property="item" typeof="WebPage">
<span property="name">About the fork</span>
</a>
<meta property="position" content="0">
</li>
<li property="itemListElement" typeof="ListItem">
<a href="../cs/" class="menu-item " property="item" typeof="WebPage">
<span property="name">Česky</span>
</a>
<meta property="position" content="1">
</li>
<li property="itemListElement" typeof="ListItem">
<a href="#" class="menu-item" data-toggle="modal" data-target="#mkdocs_search_modal" property="item" typeof="SearchAction">
<i aria-hidden="true" class="fa fa-search"></i> <span property="name">Search</span>
</a>
<meta property="position" content="2">
</li>
</ul>
</nav>
</div>
</div>
<div class="container">
<div class="terminal-mkdocs-main-grid"><aside id="terminal-mkdocs-side-panel"><nav>
<ul class="terminal-mkdocs-side-nav-items">
<li class="terminal-mkdocs-side-nav-li">
<a class="terminal-mkdocs-side-nav-item" href="..">About the fork</a>
</li>
<li class="terminal-mkdocs-side-nav-li">
<a class="terminal-mkdocs-side-nav-item" href="../cs/">Česky</a>
</li>
<li class="terminal-mkdocs-side-nav-li">
<span class="
terminal-mkdocs-side-nav-item--active terminal-mkdocs-side-nav-section-no-index">Fork meshcore-tth</span>
<ul class="terminal-mkdocs-side-nav-li-ul">
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../tth-commands/">Console commands</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../ota/">Firmware update by the admin (OTA)</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../power/">Power saving</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<span class="terminal-mkdocs-side-nav-item--active">Budka as a sensor</span>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../ble-lora-coexistence/">BLE/LoRa coexistence</a>
</li>
</ul>
</li>
<li class="terminal-mkdocs-side-nav-li">
<span class="
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">MeshCore (upstream)</span>
<ul class="terminal-mkdocs-side-nav-li-ul">
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../meshcore/">Introduction</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../faq/">FAQ</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../cli_commands/">CLI commands</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../companion_cli/">Companion CLI</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../companion_protocol/">Companion protocol</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../terminal_chat_cli/">Terminal chat CLI</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../kiss_modem_protocol/">KISS modem protocol</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../packet_format/">Packet format</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../payloads/">Payloads</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../stats_binary_frames/">Stats binary frames</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../number_allocations/">Number allocations</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../qr_codes/">QR codes</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../radio_presets/">Radio presets</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../nrf52_power_management/">nRF52 power management</a>
</li>
</ul>
</li>
</ul>
</nav><hr>
<nav>
<ul>
<li><a href="#budka-link-a-chytra-budka-as-a-sensor-source">Budka link — a Chytra Budka as a sensor source</a></li>
<li><a href="#build">Build</a></li><li><a href="#wiring">Wiring</a></li><li><a href="#telemetry-layout">Telemetry layout</a></li><li><a href="#bench-result-13-10-2026">Bench result (13. 10. 2026)</a></li><li><a href="#not-done">Not done</a></li>
</ul>
</nav>
</aside>
<main id="terminal-mkdocs-main-content">
<section id="mkdocs-terminal-content">
<h1 id="budka-link-a-chytra-budka-as-a-sensor-source">Budka link — a Chytra Budka as a sensor source</h1>
<p>A Chytra Budka (ESP32-S3 bird box) sends its readings over a one-way UART line
to a XIAO nRF52840 running <code>simple_sensor</code>; the sensor serves them as
CayenneLPP telemetry to anyone on the mesh. The line format and the budka side
are documented in the chytra-budka repo, <code>firmware/MESHCORE.md</code>.</p>
<h2 id="build">Build</h2>
<p><code>BudkaLinkSensorManager</code> (<code>src/helpers/sensors/</code>) replaces the variant's
<code>EnvironmentSensorManager</code> when the env defines <code>BUDKA_LINK_RX_PIN</code>; every
other env is unchanged.</p>
<div class="highlight"><pre><span></span><code><span class="na">[env</span><span class="o">:</span><span class="s">Xiao_x1_budka]</span><span class="w"> </span><span class="c1">; platformio.local.ini</span>
<span class="na">extends</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">env:Xiao_nrf52_sensor</span>
<span class="na">build_flags</span><span class="w"> </span><span class="o">=</span>
<span class="w"> </span><span class="na">${env</span><span class="o">:</span><span class="s">Xiao_nrf52_sensor.build_flags}</span>
<span class="w"> </span><span class="na">${test_radio.build_flags} ; bench</span><span class="o">:</span><span class="w"> </span><span class="s">test band only</span>
<span class="w"> </span><span class="na">-D BUDKA_LINK_RX_PIN</span><span class="o">=</span><span class="s">0</span><span class="w"> </span><span class="c1">; D0 = the only pad LoRa + I²C leave free</span>
</code></pre></div>
<p>Optional: <code>BUDKA_LINK_TX_PIN</code> (default <code>LED_GREEN</code> — nothing is ever sent, the
idle-high line keeps that LED dark), <code>BUDKA_LINK_BAUD</code> (115200),
<code>BUDKA_LINK_METERS</code> (3), <code>BUDKA_LINK_STALE_MS</code> (120 s).</p>
<h2 id="wiring">Wiring</h2>
<p>Budka <code>mc_tx</code> pad → XIAO <strong>D0</strong>, GND ↔ GND, each board on its own USB. A
1 kΩ series resistor protects against back-powering when one side is off.</p>
<h2 id="telemetry-layout">Telemetry layout</h2>
<table>
<thead>
<tr>
<th>channel</th>
<th>content</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>the node itself</td>
</tr>
<tr>
<td>next</td>
<td>budka: temperature, humidity, pressure, motion count (generic sensor)</td>
</tr>
<tr>
<td>next + k</td>
<td>UC96 meter <em>k</em>: voltage, current, power (analog input), energy (kWh)</td>
</tr>
</tbody>
</table>
<p>A line with a bad checksum is dropped whole; a value not refreshed for 2 min is
left out. Meter channels stay reserved while a meter is missing.</p>
<p>Read it with <code>.tth/tools/budka_telem.py &lt;companion-port&gt; &lt;sensor-name&gt;</code>. The sensor
answers only clients in its ACL — a request from anyone else is dropped
(<code>recv matches no peers</code> in a <code>MESH_DEBUG</code> build). Add the companion from the
sensor's USB console with <code>setperm &lt;companion-pubkey&gt; 1</code>, or log in as admin.
The port may be a pyserial URL (<code>socket://…</code> for an openHop companion), and the
name may be the sensor's public key when the companion does not have it yet.</p>
<h2 id="bench-result-13-10-2026">Bench result (13. 10. 2026)</h2>
<p>x1 (sensor, test band) fed by the bench budka; x4 as USB companion:</p>
<div class="highlight"><pre><span></span><code>ch2 temp_C 25.3 humidity_% 59.0 generic 29
ch3 voltage_V 4.94 current_A 0.10 analog_in 0.49 energy_kWh 0.111
ch4 voltage_V 4.94 current_A 0.18 analog_in 0.89 energy_kWh 0.311
</code></pre></div>
<h2 id="not-done">Not done</h2>
<p>Alerts (reed opened, budka WiFi down) and the return direction (mesh → budka).
The sensor build has no <code>dfu</code> console command — reflash with
<code>pio run -t upload</code>, one touch per power session.</p>
</section>
</main>
</div>
<hr><footer>
<div class="terminal-mkdocs-footer-grid">
<div id="terminal-mkdocs-footer-copyright-info">
Site built with <a href="http://www.mkdocs.org">MkDocs</a> and <a href="https://github.com/ntno/mkdocs-terminal">Terminal for MkDocs</a>.
</div>
</div>
</footer>
</div>
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="alertdialog" aria-modal="true" aria-labelledby="searchModalLabel">
<div class="modal-dialog modal-lg" role="search">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="searchModalLabel">Search</h5>
<button type="button" class="close btn btn-default btn-ghost" data-dismiss="modal" aria-label="Close">x</button>
</div>
<div class="modal-body">
<p id="searchInputLabel">Type to start searching</p>
<form>
<div class="form-group">
<input type="search" class="form-control" aria-labelledby="searchInputLabel" placeholder="" id="mkdocs-search-query" title="Please enter search terms here">
</div>
</form>
<div id="mkdocs-search-results" data-no-results-text="No document matches found"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>
Executable
+156
View File
@@ -0,0 +1,156 @@
#!/usr/bin/env bash
# usage
# sh build.sh build-firmware RAK_4631_Repeater
# sh build.sh build-firmwares
# sh build.sh build-companion-firmwares
# sh build.sh build-repeater-firmwares
# sh build.sh build-room-server-firmwares
# get a list of pio env names that start with "env:"
get_pio_envs() {
echo $(pio project config | grep 'env:' | sed 's/env://')
}
# $1 should be the string to find (case insensitive)
get_pio_envs_containing_string() {
shopt -s nocasematch
envs=($(get_pio_envs))
for env in "${envs[@]}"; do
if [[ "$env" == *${1}* ]]; then
echo $env
fi
done
}
# build firmware for the provided pio env in $1
build_firmware() {
# get git commit sha
COMMIT_HASH=$(git rev-parse --short HEAD)
# set firmware build date
FIRMWARE_BUILD_DATE=$(date '+%d-%b-%Y')
# get FIRMWARE_VERSION, which should be provided by the environment
if [ -z "$FIRMWARE_VERSION" ]; then
echo "FIRMWARE_VERSION must be set in environment"
exit 1
fi
# set firmware version string
# e.g: v1.0.0-abcdef
FIRMWARE_VERSION_STRING="${FIRMWARE_VERSION}-${COMMIT_HASH}"
# craft filename
# e.g: RAK_4631_Repeater-v1.0.0-SHA
FIRMWARE_FILENAME="$1-${FIRMWARE_VERSION_STRING}"
# export build flags for pio so we can inject firmware version info
export PLATFORMIO_BUILD_FLAGS="-DFIRMWARE_BUILD_DATE='\"${FIRMWARE_BUILD_DATE}\"' -DFIRMWARE_VERSION='\"${FIRMWARE_VERSION_STRING}\"'"
# build firmware target
pio run -e $1
# build merge-bin for esp32 fresh install
if [ -f .pio/build/$1/firmware.bin ]; then
pio run -t mergebin -e $1
fi
# build .uf2 for nrf52 boards
if [[ -f .pio/build/$1/firmware.zip && -f .pio/build/$1/firmware.hex ]]; then
python bin/uf2conv/uf2conv.py .pio/build/$1/firmware.hex -c -o .pio/build/$1/firmware.uf2 -f 0xADA52840
fi
# copy .bin, .uf2, and .zip to out folder
# e.g: Heltec_v3_room_server-v1.0.0-SHA.bin
# e.g: RAK_4631_Repeater-v1.0.0-SHA.uf2
# copy .bin for esp32 boards
cp .pio/build/$1/firmware.bin out/${FIRMWARE_FILENAME}.bin 2>/dev/null || true
cp .pio/build/$1/firmware-merged.bin out/${FIRMWARE_FILENAME}-merged.bin 2>/dev/null || true
# copy .zip and .uf2 of nrf52 boards
cp .pio/build/$1/firmware.uf2 out/${FIRMWARE_FILENAME}.uf2 2>/dev/null || true
cp .pio/build/$1/firmware.zip out/${FIRMWARE_FILENAME}.zip 2>/dev/null || true
}
# firmwares containing $1 will be built
build_all_firmwares_matching() {
envs=($(get_pio_envs_containing_string "$1"))
for env in "${envs[@]}"; do
build_firmware $env
done
}
build_repeater_firmwares() {
# # build specific repeater firmwares
# build_firmware "Heltec_v2_repeater"
# build_firmware "Heltec_v3_repeater"
# build_firmware "Xiao_C3_Repeater_sx1262"
# build_firmware "Xiao_S3_WIO_Repeater"
# build_firmware "LilyGo_T3S3_sx1262_Repeater"
# build_firmware "RAK_4631_Repeater"
# build all repeater firmwares
build_all_firmwares_matching "repeater"
}
build_companion_firmwares() {
# # build specific companion firmwares
# build_firmware "Heltec_v2_companion_radio_usb"
# build_firmware "Heltec_v2_companion_radio_ble"
# build_firmware "Heltec_v3_companion_radio_usb"
# build_firmware "Heltec_v3_companion_radio_ble"
# build_firmware "Xiao_S3_WIO_companion_radio_ble"
# build_firmware "LilyGo_T3S3_sx1262_companion_radio_usb"
# build_firmware "LilyGo_T3S3_sx1262_companion_radio_ble"
# build_firmware "RAK_4631_companion_radio_usb"
# build_firmware "RAK_4631_companion_radio_ble"
# build_firmware "t1000e_companion_radio_ble"
# build all companion firmwares
build_all_firmwares_matching "companion_radio_usb"
build_all_firmwares_matching "companion_radio_ble"
}
build_room_server_firmwares() {
# # build specific room server firmwares
# build_firmware "Heltec_v3_room_server"
# build_firmware "RAK_4631_room_server"
# build all room server firmwares
build_all_firmwares_matching "room_server"
}
build_firmwares() {
build_companion_firmwares
build_repeater_firmwares
build_room_server_firmwares
}
# clean build dir
rm -rf out
mkdir -p out
# handle script args
if [[ $1 == "build-firmware" ]]; then
if [ "$2" ]; then
build_firmware $2
fi
elif [[ $1 == "build-firmwares" ]]; then
build_firmwares
elif [[ $1 == "build-companion-firmwares" ]]; then
build_companion_firmwares
elif [[ $1 == "build-repeater-firmwares" ]]; then
build_repeater_firmwares
elif [[ $1 == "build-room-server-firmwares" ]]; then
build_room_server_firmwares
fi
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
-889
View File
@@ -1,889 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-terminal-4.8.0">
<meta name="description" content="MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults">
<link rel="canonical" href="https://tth-pub.pages.rfa.cz/meshcore-tth/cs/"><link rel="icon" type="image/png" sizes="192x192" href="../img/android-chrome-192x192.png" />
<link rel="icon" type="image/png" sizes="512x512" href="../img/android-chrome-512x512.png" />
<link rel="apple-touch-icon" sizes="180x180" href="../img/apple-touch-icon.png" />
<link rel="shortcut icon" type="image/png" sizes="48x48" href="../img/favicon.ico" />
<link rel="icon" type="image/png" sizes="16x16" href="../img/favicon-16x16.png" />
<link rel="icon" type="image/png" sizes="32x32" href="../img/favicon-32x32.png" />
<title>Česky - MeshCore TTH</title>
<link href="../css/fontawesome/css/fontawesome.min.css" rel="stylesheet">
<link href="../css/fontawesome/css/solid.min.css" rel="stylesheet">
<link href="../css/normalize.css" rel="stylesheet">
<link href="../css/terminal.css" rel="stylesheet">
<link href="../css/theme.css" rel="stylesheet">
<link href="../css/theme.tile_grid.css" rel="stylesheet">
<link href="../css/theme.footer.css" rel="stylesheet">
<!-- dark color palette -->
<link href="../css/palettes/dark.css" rel="stylesheet">
<!-- page layout -->
<style>
/* initially set page layout to a one column grid */
.terminal-mkdocs-main-grid {
display: grid;
grid-column-gap: 1.4em;
grid-template-columns: auto;
grid-template-rows: auto;
}
/*
* when side navigation is not hidden, use a two column grid.
* if the screen is too narrow, fall back to the initial one column grid layout.
* in this case the main content will be placed under the navigation panel.
*/
@media only screen and (min-width: 70em) {
.terminal-mkdocs-main-grid {
grid-template-columns: 4fr 9fr;
}
}</style>
<!-- cursor_animation override -->
<style>
#mkdocs-terminal-site-name.terminal-prompt::after {
display: none;
}
</style>
<link href="../_stylesheets/tth.css" rel="stylesheet">
<!-- search css support -->
<link href="../css/search/bootstrap-modal.css" rel="stylesheet">
<!-- search scripts -->
<script>
var base_url = "..",
shortcuts = "{}";
</script>
<script src="../js/jquery/jquery-1.10.1.min.js" defer></script>
<script src="../js/bootstrap/bootstrap.min.js" defer></script>
<script src="../js/mkdocs/base.js" defer></script>
<script src="../search/main.js"></script>
</head>
<body class="terminal"><div class="container">
<div class="terminal-nav">
<header class="terminal-logo">
<div id="mkdocs-terminal-site-name" class="logo terminal-prompt"><a href="https://tth-pub.pages.rfa.cz/meshcore-tth/" class="no-style">MeshCore TTH</a></div>
</header>
<nav class="terminal-menu">
<ul vocab="https://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
<a href=".." class="menu-item " property="item" typeof="WebPage">
<span property="name">About the fork</span>
</a>
<meta property="position" content="0">
</li>
<li property="itemListElement" typeof="ListItem">
<a href="./" class="menu-item active" property="item" typeof="WebPage">
<span property="name">Česky</span>
</a>
<meta property="position" content="1">
</li>
<li property="itemListElement" typeof="ListItem">
<a href="#" class="menu-item" data-toggle="modal" data-target="#mkdocs_search_modal" property="item" typeof="SearchAction">
<i aria-hidden="true" class="fa fa-search"></i> <span property="name">Search</span>
</a>
<meta property="position" content="2">
</li>
</ul>
</nav>
</div>
</div>
<div class="container">
<div class="terminal-mkdocs-main-grid"><aside id="terminal-mkdocs-side-panel"><nav>
<ul class="terminal-mkdocs-side-nav-items">
<li class="terminal-mkdocs-side-nav-li">
<a class="terminal-mkdocs-side-nav-item" href="..">About the fork</a>
</li>
<li class="terminal-mkdocs-side-nav-li">
<span class="terminal-mkdocs-side-nav-item--active">Česky</span>
</li>
<li class="terminal-mkdocs-side-nav-li">
<span class="
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">Fork meshcore-tth</span>
<ul class="terminal-mkdocs-side-nav-li-ul">
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../tth-commands/">Console commands</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../ota/">Firmware update by the admin (OTA)</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../power/">Power saving</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../budka-sensor/">Budka as a sensor</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../ble-lora-coexistence/">BLE/LoRa coexistence</a>
</li>
</ul>
</li>
<li class="terminal-mkdocs-side-nav-li">
<span class="
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">MeshCore (upstream)</span>
<ul class="terminal-mkdocs-side-nav-li-ul">
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../meshcore/">Introduction</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../faq/">FAQ</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../cli_commands/">CLI commands</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../companion_cli/">Companion CLI</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../companion_protocol/">Companion protocol</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../terminal_chat_cli/">Terminal chat CLI</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../kiss_modem_protocol/">KISS modem protocol</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../packet_format/">Packet format</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../payloads/">Payloads</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../stats_binary_frames/">Stats binary frames</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../number_allocations/">Number allocations</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../qr_codes/">QR codes</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../radio_presets/">Radio presets</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="../nrf52_power_management/">nRF52 power management</a>
</li>
</ul>
</li>
</ul>
</nav><hr>
<nav>
<ul>
<li><a href="#o-tomto-forku-meshcore-tth">O tomto forku (meshcore-tth)</a></li>
<li><a href="#repeater-antispam-vsechno-vypinatelne-nic-z-toho-neni-v-upstreamu">Repeater: antispam (všechno vypínatelné, nic z toho není v upstreamu)</a></li><li><a href="#diagnostika-a-provoz">Diagnostika a provoz</a></li><li><a href="#opravy-jadra">Opravy jádra</a></li><li><a href="#napajeni-hodiny-gps">Napájení, hodiny, GPS</a></li><li><a href="#senzory-a-companiony">Senzory a companiony</a></li><li><a href="#verejne-buildy-vychozi-nastaveni-pro-cesky-mesh">Veřejné buildy: výchozí nastavení pro český mesh</a></li><li><a href="#nahrani-releasu">Nahrání releasu</a></li><li><a href="#experimentalni-aktualizace-firmwaru-od-admina-ota">Experimentální: aktualizace firmwaru od admina (*-ota)</a></li><li><a href="#sestaveni">Sestavení</a></li>
</ul>
</nav>
</aside>
<main id="terminal-mkdocs-main-content">
<section id="mkdocs-terminal-content">
<h1 id="o-tomto-forku-meshcore-tth">O tomto forku (meshcore-tth)</h1>
<p><em><a href="../">English version</a> -- experimental
firmware, not meant for regular users.</em></p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p><strong>Experimentální firmware – není určený pro běžné uživatele.</strong> Tenhle fork
i všechny jeho releasy jsou osobní vývojová větev pro uzly jedné malé sítě:
rolling release nad upstreamovou větví <code>dev</code>, sestavovaný automaticky
zhruba dvakrát denně, bez stabilního kanálu, bez podpory a vyzkoušený jen
na našich deskách. Může obsahovat chyby, které uzel vyřadí z provozu,
a vrátit ho pak jde jen s USB nebo BLE v ruce. Pro běžný provoz nahrajte
oficiální MeshCore (<a href="https://flasher.meshcore.io">flasher.meshcore.io</a>).</p>
</div>
<p>Fork projektu <a href="https://github.com/meshcore-dev/MeshCore">meshcore-dev/MeshCore</a>,
na kterém běží repeatery, senzory a testovací desky malé české sítě na CZ
meshi (869,432 MHz). Upstreamové větve <code>main</code> a <code>dev</code> se slučují automaticky
dvakrát denně; všechno níže je navíc nad nimi. Náš kód je ve zdrojácích
označený <code>CUSTOM (TeTeHacko)</code>. Nic z toho nemění protokol na rádiu.</p>
<h2 id="repeater-antispam-vsechno-vypinatelne-nic-z-toho-neni-v-upstreamu">Repeater: antispam (všechno vypínatelné, nic z toho není v upstreamu)</h2>
<p><strong>Po nahrání je zapnutý jen FairnessLimiter</strong>, s limity se zhruba
dvojnásobnou rezervou nad 30 dní skutečného provozu CZ meshe: na kanál dávka
100 zpráv a pak jedna za 30 s, na odesílatele 150 a jedna za 10 s, na
původce advertu 30 a jeden za 10 min. Je to síť na utržené floody, ne kvóta;
<code>fairness off</code> ho vypne natrvalo. Okno na adverty, filtry a dry-run jsou
vypnuté, dokud je nezapnete.</p>
<ul>
<li><strong>FairnessLimiter</strong> – token buckety na přeposílané floody podle 1bajtových
identifikátorů, které jsou v paketu stejně v čitelné podobě (hash kanálu,
hash odesílatele, původce advertu). Port návrhu Beanowa
<a href="https://github.com/meshcore-dev/MeshCore/pull/1502">#1502</a>, limity
přepočítané z 30 dní skutečného provozu CZ meshe.
<code>fairness [on|off|grid|cap|refill]</code>; přímo směrovaný provoz se neomezuje nikdy.</li>
<li><strong>Okno na adverty podle původce</strong> – flood advert každého uzlu se přepošle
nejvýš jednou za N hodin (<code>fairness advert &lt;h&gt;|clear</code>), převzato
z AdvertLimiteru <a href="https://github.com/Dutch-MeshCore/MeshCore">DutchMeshCore</a>.
Míří na uzly, které advertují každou minutu.</li>
<li><strong>Dry-run</strong> – <code>fairness dryrun on</code> započítá každý verdikt, ale přepošle
i tak; <code>fairness air</code> ukáže ušetřený (nebo ušetřitelný) airtime podle důvodu.</li>
<li><strong>Filtr kanálů</strong> – na kanálech, jejichž klíč repeater zná (Public
a <code>#hashtag</code> kanály), přestane přeposílat zprávy uvedených jmen odesílatelů
(<code>filter add|del|list</code>). Jméno se dá podvrhnout: je to brzda na utrženého
bota, ne bezpečnost.</li>
<li><strong>Blokace přeposílání podle hashe kanálu</strong> – <code>filter hash add &lt;hex&gt; [s]</code>:
bez klíče, takže funguje i na soukromých kanálech; příjem se nemění, jen
přeposílání. S <code>s</code> se kanál neodřízne, ale přiškrtí (jeden paket za <code>s</code>
sekund).</li>
<li><strong>Limit stáří zprávy</strong> – <code>filter age &lt;min&gt;|off</code> (volitelné, 1–10080 min):
nepřeposílá skupinové zprávy na dešifrovaných kanálech, jejichž čas od
odesílatele je starší; bez nastavených hodin repeateru neplatí. Posuzuje
hodiny odesílatele, takže zahodí i companiony bez synchronizace času –
nastavuj ho na dny.</li>
<li><code>filter dryrun on</code> započítá každý verdikt <code>filter</code>, ale přepošle i tak.</li>
</ul>
<h2 id="diagnostika-a-provoz">Diagnostika a provoz</h2>
<p>Všechny příkazy forku, kde je který build má a výchozí hodnoty:
<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/tth-commands.md">docs/tth-commands.md</a>.</p>
<p>Repeater, room server i senzor (všechno s textovou konzolí) mají:</p>
<ul>
<li><strong>Watchdogy rádia.</strong> Hardwarový watchdog chytí jen zamrzlou smyčku; dva naše
uzly ale byly nalezeny hluché s běžící smyčkou a pomohl až restart.</li>
<li><code>set radio.silence &lt;min&gt;</code> – <strong>hluchý přijímač</strong>: když se za <code>&lt;min&gt;</code> minut
nepohne čítač přijatých rámců (počítá se i rámec s chybou CRC), uzel
napřed znovu nahodí příjem, a když ani to nepomůže, restartuje se. Každý
takový restart zdvojnásobí práh pro příští start (až 16×), první přijatý
rámec ho vrátí, takže tiché místo neskončí ve smyčce restartů. Uloží se;
<strong>ve výchozím stavu vypnutý</strong> (<code>0</code>) – práh volte s rezervou nad nejdelší
běžné ticho na místě.</li>
<li><strong>Zaseknuté vysílání</strong> (jen repeater): pakety čekají ve frontě a čítač
odeslaných se nehýbe → znovu nahodí rádio, pak restart. Prázdná fronta se
nepočítá. <strong>Zapnutý, 15 min</strong> (<code>RADIO_TXSTALL_MIN</code>); <code>set radio.txstall
&lt;min&gt;|off</code> platí jen do restartu.</li>
<li><code>get radio.reboots</code> – kolik restartů watchdogy udělaly (přežije i výpadek
napájení); <code>get boot</code> – proč se deska naposledy resetovala a záznam
o hardfaultu (vypíše se i při startu).</li>
<li><code>dfu [uf2|serial|ota]</code> – spolehlivý reboot do bootloaderu (jen z lokální
konzole); <code>i2c</code> – sken sběrnice.</li>
</ul>
<p>Repeater navíc:</p>
<ul>
<li><code>blink</code> (rozbliká LED, i přes mesh – najdete uzel na stožáru), <code>txpwr</code>
(vysílací výkon do restartu, s verdiktem RadioLibu), čítače chyb vysílání
ve stavové odpovědi.</li>
<li>Jen observer varianty (<code>*-observer</code>): textová konzole přes BLE vedle USB,
<code>ble on|off</code> uložené přes reboot (<code>RPT_BLE_DEFAULT_OFF</code>: startuje vypnuté),
vlastní BLE PIN (<code>ble pin</code>), uložený vysílací výkon spojení (<code>blepwr</code>),
<code>bleconn</code>, neblokující BLE vysílání a parametry spojení, které vydrží i na
slabém linku.</li>
<li>Taky jen observer varianty: pasivní analyzátor v konzoli – <code>nodes</code>
(slyšené repeatery a roomy, klíč pro spojení více cest), <code>rxlog</code> (každý
slyšený rámec: typ, cesta, SNR, RSSI), <code>pktlog</code> (surové rámce pro feed
observeru), velké stránkované odpovědi.</li>
<li>Jen vlastní buildy, ne releasy:</li>
<li>kanálový bot (<code>BOT_CHANNEL_PSK</code>: <code>!link</code>, <code>!path</code>, <code>!snr</code>, <code>!heard</code>,
<code>!noise</code>, <code>!ping</code>, <code>!help</code>, výběr přes <code>BOT_COMMANDS</code>, cooldown na
odesílatele, ignore list) – odpovídá, aniž by přeposílal;</li>
<li><code>RADIO_DIAG</code>: <code>radiostat</code> (stav přijímače SX1262 bez zásahu) a
<code>radiokick rx|clrirq|standby|agc</code> (jeden krok obnovy, od nejjemnějšího –
první, který pomůže, ukáže rozbitou vrstvu);</li>
<li><code>PIN_DIAG</code>: <code>dio1</code> (stav přerušení v čipu proti úrovni na pinu – který
konec mrtvé linky DIO1 je přerušený);</li>
<li><code>LORA_POLL_IRQ</code>: provoz bez DIO1 pro desku s mrtvou linkou přerušení.</li>
</ul>
<h2 id="opravy-jadra">Opravy jádra</h2>
<ul>
<li><strong>Ochrana proti přehrání admin příkazů přežije reboot.</strong> Upstream si
poslední timestamp klienta drží jen v RAM, takže po každém restartu projde
libovolný zachycený příkaz znovu – zachycený <code>reboot</code> uzel restartuje
pořád dokola. Repeater, room server i sensor ho teď zapíšou do flash dřív,
než příkaz provedou (<code>/s_acl_ts0|1</code>, střídavě s kontrolním součtem, takže
ho nesmaže ani výpadek napájení při zápisu). Timestamp víc než den před
hodinami uzlu (<code>ACL_TS_MAX_AHEAD</code>) se přijme, ale neuloží, aby companion
s rozhozenými hodinami nezamkl admina. Ukládá se jen u adminů: host smí
jen číst a s prázdným guest heslem se jím stane kdokoli, takže by každý
jeho dotaz znamenal zápis do flash. Klientů se to nijak netýká.</li>
<li><strong>Hesla nejde hádat přes éter plnou rychlostí.</strong> Upstream kontroluje každý
login bez omezení a na špatné heslo ani neodpoví. Po 4 špatných heslech
během 3 minut (<code>LOGIN_FAIL_MAX</code>, <code>LOGIN_FAIL_SECS</code>) se hesla do konce okna
nekontrolují. Klient, který už je v ACL jako admin, projde vždy – login
jeho jménem nikdo jiný poslat nedokáže, takže útok adminy nezamkne.</li>
<li><strong>Přehraný login bez hesla už nevyvolá flood odpověď.</strong> Login klienta z ACL
s prázdným heslem neměl ochranu proti přehrání; útočník tím nic nezískal,
ale každá kopie donutila uzel poslat odpověď floodem přes celý mesh.</li>
<li>TRACE už nepřipisuje cestu za konec payloadu; parsování TRACE/PATH
a <code>Packet::readFrom</code> hlídají meze.</li>
<li><code>markSeen</code> je zase idempotentní (odesílací cesta ujídala okno deduplikace).</li>
<li>Záložní výpočet v <code>calcMaxPacketMillis</code> už nepodteče (uzel na tom ohluchl).</li>
<li>Šířka path hashe se bere z nastavení uzlu na všech cestách vysílání včetně
<code>sendZeroHop</code>; výchozí jsou 2bajtové path hashe (<code>PATH_HASH_MODE_DEFAULT</code>).</li>
<li>Nepovedené vysílání se zařadí znovu s odstupem, místo aby se zahodilo.</li>
<li>RSSI každého paketu se zaznamená při příjmu; <code>ContactInfo</code> se před
částečným vyplněním vynuluje.</li>
</ul>
<h2 id="napajeni-hodiny-gps">Napájení, hodiny, GPS</h2>
<ul>
<li>GPS duty cycle (<code>gps duty</code>), i na T1000-E, kde nebyl: přijímač běží jen
kolem synchronizace hodin (jednou denně, po neúspěšném okně znovu za 6 h).
Dotaz na polohu přijímač probudí pro příští dotaz.</li>
<li>Uzel bez GPS startuje na čase sestavení firmwaru, ne v roce 2024; hodiny
a záznam o hardfaultu přežijí teplý reset (<code>.noinit</code>); <code>clkreboot</code>.</li>
<li>Na solárních uzlech žádná blikající LED a pomalejší BLE advertising.</li>
<li>Stav baterie jako ikona na konci advertovaného jména: <code>set batt.icon on</code>,
prahy <code>set batt.icon.lo|hi &lt;mV&gt;</code> (výchozí vypnuté; dlouhé jméno ikonu
nepojme a příkaz na to upozorní).</li>
<li>Volitelný RX duty cycle (<code>set radio.rxps off|on|balanced|max</code>, jemněji
<code>level &lt;1-10&gt;</code>; port PowerSaving z EasySkyMesh): SX1262 mezi krátkými okny
poslechu spí. Ve veřejných buildech je zabudovaný a <strong>vypnutý</strong>; <code>max</code> na
lavici ušetřil ~2,3 mA bez ztráty paketů (<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/power.md">docs/power.md</a>),
na ostrém meshi ale jeden náš stožár ztratil 16 % příjmu – zapínat s rozmyslem. Jen
SX1262, ne LR1110 (T1000-E).</li>
<li>Podpěťová pojistka při startu (<code>PWRMGT_VOLTAGE_BOOTLOCK</code>) je na nRF52
<strong>vypnutá</strong>, stejně jako v upstreamu od v1.18.0
(<a href="https://github.com/meshcore-dev/MeshCore/pull/2377">#2377</a>): pevný práh
3,3 V nepouštěl k životu uzly na LiFePO4 nebo LTO. Firmware tak naběhne na
jakékoli chemii článku; před hlubokým vybitím má chránit BMS nebo ochranná
destička článku. Konfigurovatelná pojistka podle chemie čeká na upstream
(<a href="https://github.com/meshcore-dev/MeshCore/pull/2088">#2088</a>). Výjimkou je
<code>SenseCap_Solar_repeater</code> (Li-ion, naše stožáry): pojistka je zapnutá
a oba prahy jdou nastavit za běhu, i přes mesh jako admin –
<code>set pwr.bootlock &lt;mV&gt;|off</code> (výchozí 3300, pod ním uzel nenaběhne a spí,
dokud se článek nezotaví) a <code>set pwr.cutoff &lt;mV&gt;|off</code> (výchozí vypnuto,
pod ním se běžící uzel vypne); <code>get pwr</code> (<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/power.md">docs/power.md</a>).</li>
</ul>
<h2 id="senzory-a-companiony">Senzory a companiony</h2>
<ul>
<li><code>simple_sensor</code>: telemetrie z externí stanice po UART
(<code>BudkaLinkSensorManager</code>, jeden LPP kanál na veličinu), <code>sensor read</code>.</li>
<li>Senzory, které jinak měří nepřetržitě (INA219, INA226, INA260, INA3221,
BMP280), mezi čteními telemetrie spí a měří jen na vyžádání (nápad a první
patch pro INA219: Alkel Brostl). Čipy INA se rozlišují podle ID, takže
INA226 už se nedetekuje jako INA219. Odpor bočníku se nastavuje za běhu
a ukládá se: <code>sensor set ina.shunt &lt;mΩ&gt;</code>.</li>
<li>Companion: <code>gps duty</code> přežije reboot, kopie data sestavení má hlídanou
délku. Export privátního klíče, čtení BLE PINu a jeho změna (i přes CLI
<code>set pin</code>) jdou jen přes spárované BLE, ne přes USB, UART ani WiFi/TCP,
a odpověď s klíčem či PINem jde jen tam, odkud přišel dotaz. (Merge v1.17
tu kontrolu potichu vyřadil; build bez BLE bere své jediné rozhraní dál
jako důvěryhodné.) KISS modem: oprava o jedna vedle při zkracování jména.</li>
</ul>
<h2 id="verejne-buildy-vychozi-nastaveni-pro-cesky-mesh">Veřejné buildy: výchozí nastavení pro český mesh</h2>
<p>Releasy z tohoto repozitáře (<code>pub-release</code>) jsou přednastavené pro český
mesh podle wiki <a href="https://meshcore.cz/">meshcore.cz</a>, takže čerstvě nahraný
uzel nepotřebuje obvyklé kolečko nastavování:</p>
<ul>
<li>rádio 869,432 MHz / 62,5 kHz / SF7 / CR5 (všechny buildy);</li>
<li>repeater a room server: zero-hop advert vypnutý, flood advert každých 25 h,
duty cycle 10 % (<code>get dutycycle</code> → <code>10.0%</code>; zastaralé <code>af</code> je 9);</li>
<li>repeater: regiony <code>cz</code> a <code>cs</code> vedle <code>*</code> – vlastní <code>cz-&lt;kraj&gt;</code> přidáš přes
<code>region put cz-xxx cz</code> + <code>region save</code>;</li>
<li>2bajtové path hashe (výchozí v tomto forku);</li>
<li>repeater: filtr kanálů (<code>filter add &lt;jméno&gt;</code>) je zabudovaný pro Public,
<code>#meshcore</code> a <code>#test</code>, s prázdným seznamem – nedělá nic, dokud do něj
nepřidáš jméno.</li>
</ul>
<p>Platí jen pro uzel bez uloženého nastavení (nový nebo po <code>erase</code>): nové
nahrání ponechá, co už uzel má, a regiony, které jsi smazal a uložil,
zůstanou smazané. Jméno a admin heslo si nastav sám.</p>
<p><strong>BLE PIN companionu je veřejný <code>123456</code></strong> (desky s displejem si losují
vlastní a ukážou ho). Kdo se s ním spáruje, má companion celý: zprávy,
kontakty, export privátního klíče. Po prvním spárování ho proto změň
v aplikaci. A s deskou v ruce nechrání nic ani PIN, ani heslo: flash není
zamčená a bootloader přijme jakýkoli firmware. Ztracený nebo ukradený uzel
ber jako vyzrazený – u repeateru změň admin heslo všude, kde bylo stejné,
a vyhoď jeho klíč z ACL; u companionu ber kanály, které na něm byly, jako
známé.</p>
<p>Varianty observer (<code>*_repeater-observer-*</code>) nRF52 repeaterů (XIAO, SenseCAP
Solar, RAK4631, T1000-E, Heltec T114) přidávají buffery <code>nodes</code> / <code>rxlog</code> /
<code>pktlog</code> a textovou konzoli přes BLE, aby šel repeater číst přes USB nebo BLE
(<a href="https://git.rfa.cz/tth-pub/meshcore-repeater-observer">meshcore-repeater-observer</a>).
BLE konzole je po nahrání <strong>vypnutá</strong> (<code>RPT_BLE_DEFAULT_OFF</code>). Nemá vlastní
přihlášení, jen BLE PIN, a PIN v buildu je veřejný zástupný <code>123456</code>. Nejdřív
si proto nastav vlastní – v USB konzoli, nebo jako admin přes mesh (vzdálené
CLI v aplikaci): <code>ble pin &lt;6 číslic&gt;</code> (uloží se a přežije reboot i nové
nahrání; zároveň smaže všechny bondy, takže spárovaná zařízení se párují
znovu). Teprve pak <code>ble on</code> – dokud je PIN zástupný, tyhle buildy ho odmítnou.
<code>ble</code> ukáže, jestli je PIN <code>own</code> nebo <code>build default</code>, samotný PIN nikdy.
Releasy do <code>tth-654d53f3</code> <code>ble pin</code> nemají: BLE tam nech vypnuté a používej USB.</p>
<h2 id="nahrani-releasu">Nahrání releasu</h2>
<p>Každý release je automatický build nad upstreamovým <code>dev</code> (viz upozornění
nahoře), ne stabilní verze. Nahrávejte ho jen na uzly, na které dosáhnete,
a nový release vždy nejdřív na jeden z nich.</p>
<p>Soubory jsou v <a href="https://git.rfa.cz/tth-pub/meshcore-tth/releases">Releases</a>.
Release se jmenuje podle upstreamové verze a data, např.
<code>v1.18.0+tth.20261112</code> (druhý téhož dne <code>.2</code>), a v popisu má změny od
předchozího releasu. Pro každou desku a roli je jedna sada
(<code>&lt;deska&gt;_&lt;role&gt;-&lt;release&gt;</code>, např. <code>Xiao_nrf52_repeater-v1.18.0+tth.20261112.zip</code>):
<code>.zip</code> a <code>.uf2</code> pro nRF52, <code>.bin</code> pro ESP32 (<code>-merged.bin</code> je celý obraz pro
prázdnou desku, obyčejný <code>.bin</code> aktualizace). Kontrolní součty jsou
v <code>SHA256SUMS</code>. Releasy do 12. 11. 2026 se jmenovaly <code>tth-&lt;sha&gt;</code>.</p>
<p><strong>nRF52 (XIAO, RAK4631, SenseCAP Solar, T1000-E, T114) přes
<a href="https://flasher.meshcore.io">webový flasher MeshCore</a></strong> – Chrome, Edge nebo
Chromium na počítači (Web Serial; ne Firefox ani Safari):</p>
<ol>
<li>Připoj desku přes USB.</li>
<li>Klikni na <strong>Custom Firmware</strong> a vyber <code>.zip</code> pro svou desku.</li>
<li>Klikni na <strong>Enter DFU mode</strong> a vyber sériový port desky. Deska se
restartuje do bootloaderu a objeví se jako nový port.</li>
<li>Klikni na <strong>Flash!</strong> a vyber ten nový port. Zhruba 30 s, pak se deska
restartuje do nového firmwaru.</li>
<li><strong>Console</strong> ve flasheru (nebo jakýkoli sériový terminál, 115200) ověří
výsledek: <code>ver</code> ukáže <code>v1.xx.x-tth&lt;sha&gt;</code>, stejně jako řádek „Verze v uzlu“
v popisu releasu.</li>
</ol>
<p><strong>Neklikej na Erase Flash</strong>, pokud nechceš nový uzel: smaže identitu (klíč
uzlu a všechno, co ho zná) i veškeré nastavení. Obyčejné nahrání je zachová.</p>
<p>Vyzkoušeno na XIAO (repeater-observer, 3. 11. 2026). ESP32 <code>.bin</code> přes stejné
tlačítko Custom Firmware tu vyzkoušené není.</p>
<p>Bez webového flasheru: na většině desek otevře dvojí stisk resetu bootloader
jako USB disk; zkopíruj na něj <code>.uf2</code>. Nebo
<code>adafruit-nrfutil dfu serial -pkg &lt;soubor&gt;.zip -p &lt;port&gt; -b 115200</code> s deskou
v bootloaderu.</p>
<p>Nový uzel po nahrání nastav v konzoli: <code>set name &lt;jméno&gt;</code>,
<code>password &lt;admin heslo&gt;</code> (nejvýš 15 znaků), vlastní region přes
<code>region put cz-&lt;kraj&gt; cz</code> + <code>region save</code>. Repeater přeposílá od prvního
startu (výchozí v upstreamu) a tyhle buildy jsou na ostré CZ frekvenci: na
stole bez antény dej <code>set repeat off</code>, dokud není na místě.</p>
<h2 id="experimentalni-aktualizace-firmwaru-od-admina-ota">Experimentální: aktualizace firmwaru od admina (<code>*-ota</code>)</h2>
<p>Každý nRF52 build s textovou konzolí (repeater, observer, room server,
senzor) je v releasu ještě jednou jako <strong>experimentální</strong> <code>*-ota</code> /
<code>*-observer-ota</code>. Ten umí přijmout nový firmware od admina příkazy <code>fw …</code>:
v USB nebo BLE konzoli, nebo <strong>přes mesh jako vzdálené admin CLI</strong>. Bez změny
bootloaderu a bez druhé banky: uzel si balíček uloží do volné flash,
zkontroluje ho celý (podpis, hashe, nanečisto provedená delta) a přepíše se
až na <code>fw apply</code>, rutinou běžící z RAM. Když během přepisu vypadne napájení,
zůstane v bootloaderu a vrátí se přes USB/BLE DFU.</p>
<ul>
<li>V releasu je ke každému <code>*-ota</code> obrazu plný balíček
<code>&lt;deska&gt;_&lt;role&gt;-ota-&lt;release&gt;.mcfw</code> (jen přes USB/BLE) a delta
<code>….from-&lt;starší release&gt;.mcfw</code> od každého drženého předchozího releasu,
typicky jednotky kB.</li>
<li><strong>Přes mesh uzel přijme jen deltu, a nikdy ne starší verzi, než má</strong> –
vynucuje to uzel, ne nástroj. Plný obraz nebo návrat ke starší verzi jen
lokálně (<code>fw apply downgrade</code>). <code>fw apply</code> čeká na baterii ≥ 3,8 V, pokud
uzel neběží z USB.</li>
<li>Balíčky i <code>SHA256SUMS</code> jsou podepsané klíčem <code>meshcore-ota@tth-pub</code>
a <code>*-ota</code> obraz jiný podpis nepřijme. Ověření stažených souborů:
<code>ssh-keygen -Y verify -f tools/ota_allowed_signers -I meshcore-ota@tth-pub
-n meshcore-ota -s SHA256SUMS.sig &lt; SHA256SUMS</code>. Vlastní build s vlastním
klíčem: <code>[ota] pubkey</code> v <code>platformio.local.ini</code>.</li>
<li>První <code>*-ota</code> obraz se nahraje obyčejně (viz výše), další už jako delta.
Nástroje: <code>tools/ota_push.py</code> (USB), <code>tools/ota_mesh_push.py</code> (přes mesh
skrz companion; potřebuje pythonovou knihovnu <code>meshcore</code>, admin heslo bere
z <code>[secrets] admin_pw</code> v <code>platformio.local.ini</code>; s <code>--side</code> jde přenos po
vedlejším kanálu mimo sdílený mesh), <code>tools/ota_pack.py info</code>. Přenos samotný
je OTA engine kolekce
<a href="https://git.rfa.cz/tth-pub/meshcore-ansible">tth.meshcore</a> (modul
<code>meshcore_fw_ota</code>), stejný kód pro nástroje i Ansible. Z telefonu: fork
aplikace <a href="https://git.rfa.cz/tth-pub/meshcore-open">meshcore-open</a>, správa
repeateru → Firmware update (OTA), deltu si najde v releasu sám.
Postup a čísla: <a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/ota.md">docs/ota.md</a>.</li>
<li><strong>Experimentální i v rámci tohoto forku</strong>: obrazy přicházejí s každým
releasem (viz upozornění nahoře) a nemají druhou banku ani automatický
návrat. Vadný firmware, který nabootuje, běží, dokud nepošlete další;
takový, který nenabootuje, chce USB/BLE DFU v ruce. Vyzkoušeno na lavici
(XIAO, USB, mesh, vedlejší kanál) a od 13. 11. 2026 na dvou našich
stožárech. Proti obrazu, který nabootuje s mrtvým rádiem, jsou watchdogy
rádia (viz Diagnostika a provoz): pro uzly, kam posíláte OTA, zapněte
<code>set radio.silence</code>. Stojí ~10 kB RAM navíc.</li>
</ul>
<h2 id="sestaveni">Sestavení</h2>
<ul>
<li>Razítko verze v každém nRF52 envu (<code>v1.18.0-tth&lt;sha&gt;</code>, <code>+</code> = neuklizený
strom), základní verze z upstreamového tagu (<code>tools/build_version.py</code>).</li>
<li><code>tools/</code>: nástroje na uzly – konzole (USB, BLE), flashování, testy na
lavici, diagnostika (<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/tools/README.md">tools/README.md</a>). Desky podle jména
bere z lokálního configu mimo repo (<code>tools/config.example.ini</code>).</li>
<li><code>hardware/cavity-box</code>: parametrická krabička pro dutinový filtr na stožár.</li>
</ul>
<hr />
</section>
</main>
</div>
<hr><footer>
<div class="terminal-mkdocs-footer-grid">
<div id="terminal-mkdocs-footer-copyright-info">
Site built with <a href="http://www.mkdocs.org">MkDocs</a> and <a href="https://github.com/ntno/mkdocs-terminal">Terminal for MkDocs</a>.
</div>
</div>
</footer>
</div>
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="alertdialog" aria-modal="true" aria-labelledby="searchModalLabel">
<div class="modal-dialog modal-lg" role="search">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="searchModalLabel">Search</h5>
<button type="button" class="close btn btn-default btn-ghost" data-dismiss="modal" aria-label="Close">x</button>
</div>
<div class="modal-body">
<p id="searchInputLabel">Type to start searching</p>
<form>
<div class="form-group">
<input type="search" class="form-control" aria-labelledby="searchInputLabel" placeholder="" id="mkdocs-search-query" title="Please enter search terms here">
</div>
</form>
<div id="mkdocs-search-results" data-no-results-text="No document matches found"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>
File diff suppressed because it is too large. Load diff
-6
View File
@@ -1,6 +0,0 @@
/*!
* Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
* Copyright 2022 Fonticons, Inc.
*/
.fa{font-family:var(--fa-style-family,"Font Awesome 6 Free");font-weight:var(--fa-style,900)}.fa,.fa-brands,.fa-classic,.fa-regular,.fa-sharp,.fa-solid,.fab,.far,.fas{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:var(--fa-display,inline-block);font-style:normal;font-variant:normal;line-height:1;text-rendering:auto}.fa-classic,.fa-regular,.fa-solid,.far,.fas{font-family:"Font Awesome 6 Free"}.fa-brands,.fab{font-family:"Font Awesome 6 Brands"}.fa-1x{font-size:1em}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-6x{font-size:6em}.fa-7x{font-size:7em}.fa-8x{font-size:8em}.fa-9x{font-size:9em}.fa-10x{font-size:10em}.fa-2xs{font-size:.625em;line-height:.1em;vertical-align:.225em}.fa-xs{font-size:.75em;line-height:.08333em;vertical-align:.125em}.fa-sm{font-size:.875em;line-height:.07143em;vertical-align:.05357em}.fa-lg{font-size:1.25em;line-height:.05em;vertical-align:-.075em}.fa-xl{font-size:1.5em;line-height:.04167em;vertical-align:-.125em}.fa-2xl{font-size:2em;line-height:.03125em;vertical-align:-.1875em}.fa-fw{text-align:center;width:1.25em}.fa-ul{list-style-type:none;margin-left:var(--fa-li-margin,2.5em);padding-left:0}.fa-ul>li{position:relative}.fa-li{left:calc(var(--fa-li-width, 2em)*-1);position:absolute;text-align:center;width:var(--fa-li-width,2em);line-height:inherit}.fa-border{border-radius:var(--fa-border-radius,.1em);border:var(--fa-border-width,.08em) var(--fa-border-style,solid) var(--fa-border-color,#eee);padding:var(--fa-border-padding,.2em .25em .15em)}.fa-pull-left{float:left;margin-right:var(--fa-pull-margin,.3em)}.fa-pull-right{float:right;margin-left:var(--fa-pull-margin,.3em)}.fa-beat{-webkit-animation-name:fa-beat;animation-name:fa-beat;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,ease-in-out);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-bounce{-webkit-animation-name:fa-bounce;animation-name:fa-bounce;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.28,.84,.42,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.28,.84,.42,1))}.fa-fade{-webkit-animation-name:fa-fade;animation-name:fa-fade;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1))}.fa-beat-fade,.fa-fade{-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s)}.fa-beat-fade{-webkit-animation-name:fa-beat-fade;animation-name:fa-beat-fade;-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1));animation-timing-function:var(--fa-animation-timing,cubic-bezier(.4,0,.6,1))}.fa-flip{-webkit-animation-name:fa-flip;animation-name:fa-flip;-webkit-animation-delay:var(--fa-animation-delay,0s);animation-delay:var(--fa-animation-delay,0s);-webkit-animation-direction:var(--fa-animation-direction,normal);animation-direction:var(--fa-animation-direction,normal);-webkit-animation-duration:var(--fa-animation-duration,1s);animation-duration:var(--fa-animation-duration,1s);-webkit-animation-iteration-count:var(--fa-animation-iteration-count,infinite);animation-iteration-count:var(--fa-animation-iteration-count,infinite);-webkit-animation-timing-function:var(--fa-animation-timing,ease-in-out);animation-timing-function:var(--fa-animation-timing,ease-in-out)}.fa-shake{-webkit-animation-name:fa-shake;animation-name:fa-shake;-webkit-animation-duration:var(--fa-animatLine truncated
-19
View File
@@ -1,19 +0,0 @@
/*!
* Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
* Copyright 2022 Fonticons, Inc.
*/
:root, :host {
--fa-style-family-classic: 'Font Awesome 6 Free';
--fa-font-solid: normal 900 1em/1 'Font Awesome 6 Free'; }
@font-face {
font-family: 'Font Awesome 6 Free';
font-style: normal;
font-weight: 900;
font-display: block;
src: url("../webfonts/fa-solid-900.woff2") format("woff2"), url("../webfonts/fa-solid-900.ttf") format("truetype"); }
.fas,
.fa-solid {
font-weight: 900; }
-6
View File
@@ -1,6 +0,0 @@
/*!
* Font Awesome Free 6.2.1 by @fontawesome - https://fontawesome.com
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
* Copyright 2022 Fonticons, Inc.
*/
:host,:root{--fa-style-family-classic:"Font Awesome 6 Free";--fa-font-solid:normal 900 1em/1 "Font Awesome 6 Free"}@font-face{font-family:"Font Awesome 6 Free";font-style:normal;font-weight:900;font-display:block;src:url(../webfonts/fa-solid-900.woff2) format("woff2"),url(../webfonts/fa-solid-900.ttf) format("truetype")}.fa-solid,.fas{font-weight:900}
Binary file not shown.
Binary file not shown.
-419
View File
@@ -1,419 +0,0 @@
/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
/* Document
========================================================================== */
/**
* 1. Correct the line height in all browsers.
* 2. Prevent adjustments of font size after orientation changes in iOS.
*/
html {
line-height: 1.15;
/* 1 */
-webkit-text-size-adjust: 100%;
/* 2 */
}
/* Sections
========================================================================== */
/**
* Remove the margin in all browsers.
*/
body {
margin: 0;
}
/**
* Render the `main` element consistently in IE.
*/
main {
display: block;
}
/**
* Correct the font size and margin on `h1` elements within `section` and
* `article` contexts in Chrome, Firefox, and Safari.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/* Grouping content
========================================================================== */
/**
* 1. Add the correct box sizing in Firefox.
* 2. Show the overflow in Edge and IE.
*/
hr {
box-sizing: content-box;
/* 1 */
height: 0;
/* 1 */
overflow: visible;
/* 2 */
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
pre {
font-family: monospace, monospace;
/* 1 */
font-size: 1em;
/* 2 */
}
/* Text-level semantics
========================================================================== */
/**
* Remove the gray background on active links in IE 10.
*/
a {
background-color: transparent;
}
/**
* 1. Remove the bottom border in Chrome 57-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
*/
abbr[title] {
border-bottom: none;
/* 1 */
text-decoration: underline;
/* 2 */
text-decoration: underline dotted;
/* 2 */
}
/**
* Add the correct font weight in Chrome, Edge, and Safari.
*/
b,
strong {
font-weight: bolder;
}
/**
* 1. Correct the inheritance and scaling of font size in all browsers.
* 2. Correct the odd `em` font sizing in all browsers.
*/
code,
kbd,
samp {
font-family: monospace, monospace;
/* 1 */
font-size: 1em;
/* 2 */
}
/**
* Add the correct font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` elements from affecting the line height in
* all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
/* Embedded content
========================================================================== */
/**
* Remove the border on images inside links in IE 10.
*/
img {
border-style: none;
}
/* Forms
========================================================================== */
/**
* 1. Change the font styles in all browsers.
* 2. Remove the margin in Firefox and Safari.
*/
button,
input,
optgroup,
select,
textarea {
font-family: inherit;
/* 1 */
font-size: 100%;
/* 1 */
line-height: 1.15;
/* 1 */
margin: 0;
/* 2 */
}
/**
* Show the overflow in IE.
* 1. Show the overflow in Edge.
*/
button,
input {
/* 1 */
overflow: visible;
}
/**
* Remove the inheritance of text transform in Edge, Firefox, and IE.
* 1. Remove the inheritance of text transform in Firefox.
*/
button,
select {
/* 1 */
text-transform: none;
}
/**
* Correct the inability to style clickable types in iOS and Safari.
*/
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
}
/**
* Remove the inner border and padding in Firefox.
*/
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
/**
* Restore the focus styles unset by the previous rule.
*/
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
/**
* Correct the padding in Firefox.
*/
fieldset {
padding: 0.35em 0.75em 0.625em;
}
/**
* 1. Correct the text wrapping in Edge and IE.
* 2. Correct the color inheritance from `fieldset` elements in IE.
* 3. Remove the padding so developers are not caught out when they zero out
* `fieldset` elements in all browsers.
*/
legend {
box-sizing: border-box;
/* 1 */
color: inherit;
/* 2 */
display: table;
/* 1 */
max-width: 100%;
/* 1 */
padding: 0;
/* 3 */
white-space: normal;
/* 1 */
}
/**
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
*/
progress {
vertical-align: baseline;
}
/**
* Remove the default vertical scrollbar in IE 10+.
*/
textarea {
overflow: auto;
}
/**
* 1. Add the correct box sizing in IE 10.
* 2. Remove the padding in IE 10.
*/
[type="checkbox"],
[type="radio"] {
box-sizing: border-box;
/* 1 */
padding: 0;
/* 2 */
}
/**
* Correct the cursor style of increment and decrement buttons in Chrome.
*/
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
/**
* 1. Correct the odd appearance in Chrome and Safari.
* 2. Correct the outline style in Safari.
*/
[type="search"] {
-webkit-appearance: textfield;
/* 1 */
outline-offset: -2px;
/* 2 */
}
/**
* Remove the inner padding in Chrome and Safari on macOS.
*/
[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* 1. Correct the inability to style clickable types in iOS and Safari.
* 2. Change font properties to `inherit` in Safari.
*/
::-webkit-file-upload-button {
-webkit-appearance: button;
/* 1 */
font: inherit;
/* 2 */
}
/* Interactive
========================================================================== */
/*
* Add the correct display in Edge, IE 10+, and Firefox.
*/
details {
display: block;
}
/*
* Add the correct display in all browsers.
*/
summary {
display: list-item;
}
/* Misc
========================================================================== */
/**
* Add the correct display in IE 10+.
*/
template {
display: none;
}
/**
* Add the correct display in IE 10.
*/
[hidden] {
display: none;
}
-31
View File
@@ -1,31 +0,0 @@
/*! blueberry.css | MIT License | github.com/ntno/mkdocs-terminal */
:root {
--cream: #ffffcc;
--black: #190910;
--digital-navy: #000080;
--authentic-blue: #3737aa;
--corn-harvest: #8a6801;
--light-grey: #d4d4d4;
--dark-grey: #5e5e5e;
--white: #f7f7f7;
--global-font-size: 15px;
--global-line-height: 1.4em;
--global-space: 10px;
--font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--mono-font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--background-color: var(--cream);
--page-width: 60em;
--font-color: var(--black);
--invert-font-color: var(--white);
--primary-color: var(--digital-navy);
--secondary-color: var(--authentic-blue);
--tertiary-color: var(--authentic-blue);
--error-color: var(--corn-harvest);
--progress-bar-background: var(--light-grey);
--progress-bar-fill: var(--dark-grey);
--code-bg-color: var(--white);
--input-style: solid;
--display-h1-decoration: none;
}
-22
View File
@@ -1,22 +0,0 @@
/*! dark.css 0.7.5 | MIT License | github.com/Gioni06/terminal.css */
:root {
--global-font-size: 15px;
--global-line-height: 1.4em;
--global-space: 10px;
--font-stack: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--mono-font-stack: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--background-color: #222225;
--page-width: 60em;
--font-color: #e8e9ed;
--invert-font-color: #222225;
--secondary-color: #a3abba;
--tertiary-color: #a3abba;
--primary-color: #62c4ff;
--error-color: #ff3c74;
--progress-bar-background: #3f3f44;
--progress-bar-fill: #62c4ff;
--code-bg-color: #3f3f44;
--input-style: solid;
--display-h1-decoration: none;
}
-4
View File
@@ -1,4 +0,0 @@
/*! terminal.css 0.7.5 | MIT License | github.com/Gioni06/terminal.css */
/* this document is intentionally left empty. for root configuration, see terminal/css/terminal.css */
-50
View File
@@ -1,50 +0,0 @@
/*! gruvbox_dark.css | MIT License | github.com/Gioni06/terminal.css/issues/9 */
:root {
--gb-dm-bg0: #282828;
--gb-dm-bg0-hard: #1d2021;
--gb-dm-bg0-soft: #32302f;
--gb-dm-bg1: #3c3836;
--gb-dm-bg2: #504945;
--gb-dm-bg3: #665c54;
--gb-dm-bg4: #7c6f64;
--gb-dm-fg0: #fbf1c7;
--gb-dm-fg1: #ebdbb2;
--gb-dm-fg2: #d5c4a1;
--gb-dm-fg3: #bdae93;
--gb-dm-fg4: #a89984;
--gb-dm-dark-red: #cc241d;
--gb-dm-dark-green: #98971a;
--gb-dm-dark-yellow: #d79921;
--gb-dm-dark-blue: #458588;
--gb-dm-dark-purple: #b16286;
--gb-dm-dark-aqua: #689d6a;
--gb-dm-dark-orange: #d65d0e;
--gb-dm-dark-gray: #928374;
--gb-dm-light-red: #fb4934;
--gb-dm-light-green: #b8bb26;
--gb-dm-light-yellow: #fabd2f;
--gb-dm-light-blue: #83a598;
--gb-dm-light-purple: #d3869b;
--gb-dm-light-aqua: #8ec07c;
--gb-dm-light-orange: #f38019;
--gb-dm-light-gray: #a89984;
--global-font-size: 15px;
--global-line-height: 1.4em;
--global-space: 10px;
--font-stack: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--mono-font-stack: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--background-color: var(--gb-dm-bg0);
--page-width: 60em;
--font-color: var(--gb-dm-fg1);
--invert-font-color: var(--gb-dm-bg0-hard);
--primary-color: var(--gb-dm-light-yellow);
--secondary-color: var(--gb-dm-fg3);
--tertiary-color: var(--gb-dm-light-gray);
--error-color: var(--gb-dm-light-red);
--progress-bar-background: var(--gb-dm-bg2);
--progress-bar-fill: var(--gb-dm-fg2);
--code-bg-color: var(--gb-dm-bg2);
--input-style: solid;
--display-h1-decoration: none;
}
-31
View File
@@ -1,31 +0,0 @@
/*! lightyear.css | MIT License | github.com/ntno/mkdocs-terminal */
:root {
--mint: #e0ffe0;
--black: #190910;
--white: #f7f7f7;
--dark-purple: #4b0082;
--grape: #805b9c;
--red: #cc2517;
--light-grey: #d4d4d4;
--dark-grey: #5e5e5e;
--global-font-size: 15px;
--global-line-height: 1.4em;
--global-space: 10px;
--font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--mono-font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--background-color: var(--mint);
--page-width: 60em;
--font-color: var(--black);
--invert-font-color: var(--white);
--primary-color: var(--dark-purple);
--secondary-color: var(--grape);
--tertiary-color: var(--grape);
--error-color: var(--red);
--progress-bar-background: var(--light-grey);
--progress-bar-fill: var(--dark-grey);
--code-bg-color: var(--white);
--input-style: solid;
--display-h1-decoration: none;
}
-22
View File
@@ -1,22 +0,0 @@
/*! pink.css | MIT License | github.com/Gioni06/terminal.css/issues/9 */
:root {
--global-font-size: 15px;
--global-line-height: 1.4em;
--global-space: 10px;
--font-stack: 'Fira Code', Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--mono-font-stack: 'Fira Code', Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--background-color: #ffffff;
--page-width: 60em;
--font-color: #190910;
--invert-font-color: #f7f7f7;
--primary-color: #f90d7a;
--secondary-color: #715864;
--tertiary-color: #715864;
--error-color: #bb0047;
--progress-bar-background: #d4d4d4;
--progress-bar-fill: #5e5e5e;
--code-bg-color: #f7f7f7;
--input-style: solid;
--display-h1-decoration: none;
}
-31
View File
@@ -1,31 +0,0 @@
/*! red_drum.css | MIT License | github.com/ntno/mkdocs-terminal */
:root {
--pale-goldenrod: #eee8aa;
--black: #190910;
--white: #f7f7f7;
--dark-red: #8b0000;
--old-rose: #8b5a5b;
--sea-blue: #00678c;
--light-grey: #d4d4d4;
--dark-grey: #5e5e5e;
--global-font-size: 15px;
--global-line-height: 1.4em;
--global-space: 10px;
--font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--mono-font-stack: "Fira Code", Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
--background-color: var(--pale-goldenrod);
--page-width: 60em;
--font-color: var(--black);
--invert-font-color: var(--white);
--primary-color: var(--dark-red);
--secondary-color: var(--old-rose);
--tertiary-color: var(--old-rose);
--error-color: var(--sea-blue);
--progress-bar-background: var(--light-grey);
--progress-bar-fill: var(--dark-grey);
--code-bg-color: var(--white);
--input-style: solid;
--display-h1-decoration: none;
}
-8
View File
@@ -1,8 +0,0 @@
/*! sans.css 0.7.5 | MIT License | github.com/Gioni06/terminal.css */
:root {
--global-font-size: 15px;
--global-line-height: 1.4em;
--font-stack: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
--input-style: solid;
}
-20
View File
@@ -1,20 +0,0 @@
/*! sans_dark.css 0.7.5 | MIT License | github.com/Gioni06/terminal.css */
:root {
--global-font-size: 15px;
--global-line-height: 1.4em;
--font-stack: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol;
--background-color: #222225;
--page-width: 60em;
--font-color: #e8e9ed;
--invert-font-color: #222225;
--secondary-color: #a3abba;
--tertiary-color: #a3abba;
--primary-color: #62c4ff;
--error-color: #ff3c74;
--progress-bar-background: #3f3f44;
--progress-bar-fill: #62c4ff;
--code-bg-color: #3f3f44;
--input-style: solid;
--display-h1-decoration: none;
}
-211
View File
@@ -1,211 +0,0 @@
/*! Terminal for MkDocs | MIT License | github.com/ntno/mkdocs-terminal */
/*!
/*! Bootstrap v4.3.1 | MIT License | github.com/twbs/bootstrap
* Copyright 2011-2019 The Bootstrap Authors
* Copyright 2011-2019 Twitter, Inc.
*/
.modal-open {
overflow: hidden;
}
.modal-open .modal {
overflow-x: hidden;
overflow-y: auto;
}
.modal {
position: fixed;
top: 0;
left: 0;
z-index: 1050;
display: none;
width: 100%;
height: 100%;
overflow: hidden;
outline: 0;
}
.modal-dialog {
position: relative;
width: auto;
margin: 0.5rem;
pointer-events: none;
}
.modal.fade .modal-dialog {
transition: -webkit-transform 0.3s ease-out;
transition: transform 0.3s ease-out;
transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out;
-webkit-transform: translate(0, -50px);
transform: translate(0, -50px);
}
@media (prefers-reduced-motion: reduce) {
.modal.fade .modal-dialog {
transition: none;
}
}
.modal.show .modal-dialog {
-webkit-transform: none;
transform: none;
}
.modal-dialog-scrollable {
display: flex;
max-height: calc(100% - 1rem);
}
.modal-dialog-scrollable .modal-content {
max-height: calc(100vh - 1rem);
overflow: hidden;
}
.modal-dialog-scrollable .modal-header,
.modal-dialog-scrollable .modal-footer {
flex-shrink: 0;
}
.modal-dialog-scrollable .modal-body {
overflow-y: auto;
}
.modal-dialog-centered {
display: flex;
align-items: center;
min-height: calc(100% - 1rem);
}
.modal-dialog-centered::before {
display: block;
height: calc(100vh - 1rem);
content: "";
}
.modal-dialog-centered.modal-dialog-scrollable {
flex-direction: column;
justify-content: center;
height: 100%;
}
.modal-dialog-centered.modal-dialog-scrollable .modal-content {
max-height: none;
}
.modal-dialog-centered.modal-dialog-scrollable::before {
content: none;
}
.modal-content {
position: relative;
display: flex;
flex-direction: column;
width: 100%;
pointer-events: auto;
background-color: var(--code-bg-color);
background-clip: padding-box;
border: 1px solid var(--font-color);
outline: 0;
}
.modal-backdrop {
position: fixed;
top: 0;
left: 0;
z-index: 1040;
width: 100vw;
height: 100vh;
background-color: #000;
}
.modal-backdrop.fade {
opacity: 0;
}
.modal-backdrop.show {
opacity: 0.5;
}
.modal-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
padding: 1rem 1rem;
border-bottom: 1px solid var(--secondary-color);
}
.modal-header .close {
padding: 1rem 1.5rem;
margin: -.7rem -.7rem -.7rem auto;
}
.modal-title {
margin-bottom: 0;
line-height: 1.5;
}
.modal-body {
position: relative;
flex: 1 1 auto;
padding: 1rem;
}
.modal-footer {
display: flex;
align-items: center;
justify-content: flex-end;
padding: 1rem;
border-top: 1px solid var(--secondary-color);
}
.modal-footer> :not(:first-child) {
margin-left: .25rem;
}
.modal-footer> :not(:last-child) {
margin-right: .25rem;
}
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll;
}
@media (min-width: 576px) {
.modal-dialog {
max-width: 500px;
margin: 1.75rem auto;
}
.modal-dialog-scrollable {
max-height: calc(100% - 3.5rem);
}
.modal-dialog-scrollable .modal-content {
max-height: calc(100vh - 3.5rem);
}
.modal-dialog-centered {
min-height: calc(100% - 3.5rem);
}
.modal-dialog-centered::before {
height: calc(100vh - 3.5rem);
}
.modal-sm {
max-width: 300px;
}
}
@media (min-width: 992px) {
.modal-lg,
.modal-xl {
max-width: 800px;
}
}
@media (min-width: 1200px) {
.modal-xl {
max-width: 1140px;
}
}
-1055
View File
File diff suppressed because it is too large. Load diff
-92
View File
@@ -1,92 +0,0 @@
/*! Terminal for MkDocs | MIT License | github.com/ntno/mkdocs-terminal */
/*! terminal.css 0.7.5 | MIT License | github.com/Gioni06/terminal.css */
body {
padding-top: 50px;
padding-bottom: 50px;
}
/* underline links in main content (except header anchor links) */
#terminal-mkdocs-main-content a:not(.headerlink) {
text-decoration: underline;
}
/* do not underline button links */
a.btn {
text-decoration: none !important;
}
.terminal-mkdocs-side-nav-item--active {
font-style: italic;
}
.terminal-mkdocs-side-nav-section-no-index {
color: var(--secondary-color);
}
.terminal-mkdocs-pad-to-match-side-nav {
padding-top: calc(var(--global-space) * 2);
}
.terminal-mkdocs-thin-border {
border: solid !important;
border-color: var(--secondary-color) !important;
border-width: thin !important;
}
.terminal-mkdocs-macro-error-banner {
border-style: solid;
border-width: 1px;
display: inline-flex;
align-items: center;
justify-content: center;
padding: .65em 2em;
border-color: var(--error-color);
}
p.terminal-mkdocs-macro-error-banner {
color: var(--font-color);
}
p.terminal-mkdocs-macro-error-banner>code {
color: var(--code-font-color);
}
/* set figcaption paragraph text to the secondary color. this occurs when using markdown inside the figcaption */
figure>figcaption>p {
color: var(--secondary-color);
}
/* ***************************************************************** */
/* Terminal.css Overrides */
/* ***************************************************************** */
/* don't display backticks on `code` items, just highlight */
code::after,
code::before {
content: "" !important;
display: inline;
}
/* use the `code-bg-color` and `code-font-color` for `<code>` blocks */
pre code {
background-color: var(--code-bg-color);
color: var(--code-font-color);
}
-25
View File
@@ -1,25 +0,0 @@
/* grid for footer */
.terminal-mkdocs-footer-grid {
display: grid;
grid-row-gap: 2em;
grid-column-gap: 2em;
grid-template-columns: auto;
grid-template-rows: auto;
}
/* place prev/next links to the right of copyright info when screen is wide enough */
@media only screen and (min-width: 50em) {
.terminal-mkdocs-footer-grid {
grid-template-columns: 6fr 3fr;
}
#terminal-mkdocs-footer-prev-next {
text-align: right;
}
}
#terminal-mkdocs-footer-copyright-info {
text-align: left;
}
-26
View File
@@ -1,26 +0,0 @@
/*! Terminal for MkDocs | MIT License | github.com/ntno/mkdocs-terminal */
.terminal-mkdocs-tile-grid {
display: grid;
grid-gap: 1em;
grid-template-rows: auto;
grid-template-columns: repeat(auto-fit, minmax(calc(var(--page-width) / 6), 1fr));
}
/* center link text within the tile */
.terminal-mkdocs-tile {
border: none;
text-align: center;
}
/* center images within the tile */
.terminal-mkdocs-tile div>figure>img,
.terminal-mkdocs-tile div>figure>a>img {
display: block;
margin-left: auto;
margin-right: auto;
}
+10
View File
@@ -0,0 +1,10 @@
{ pkgs ? import <nixpkgs> {} }:
let
in
pkgs.mkShell {
buildInputs = [
pkgs.platformio
# optional: needed as a programmer i.e. for esp32
pkgs.avrdude
];
}
+607
View File
@@ -0,0 +1,607 @@
**MeshCore-FAQ**<!-- omit from toc -->
A list of frequently-asked questions and answers for MeshCore
The current version of this MeshCore FAQ is at https://github.com/ripplebiz/MeshCore/blob/main/docs/faq.md.
This MeshCore FAQ is also mirrored at https://github.com/LitBomb/MeshCore-FAQ and might have newer updates if pull requests on Scott's MeshCore repo are not approved yet.
author: https://github.com/LitBomb<!-- omit from toc -->
---
- [1. Introduction](#1-introduction)
- [1.1. Q: What is MeshCore?](#11-q-what-is-meshcore)
- [1.2. Q: What do you need to start using MeshCore?](#12-q-what-do-you-need-to-start-using-meshcore)
- [1.2.1. Hardware](#121-hardware)
- [1.2.2. Firmware](#122-firmware)
- [1.2.3. Companion Radio Firmware](#123-companion-radio-firmware)
- [1.2.4. Repeater](#124-repeater)
- [1.2.5. Room Server](#125-room-server)
- [2. Initial Setup](#2-initial-setup)
- [2.1. Q: How many devices do I need to start using MeshCore?](#21-q-how-many-devices-do-i-need-to-start-using-meshcore)
- [2.2. Q: Does MeshCore cost any money?](#22-q-does-meshcore-cost-any-money)
- [2.3. Q: What frequencies are supported by MeshCore?](#23-q-what-frequencies-are-supported-by-meshcore)
- [2.4. Q: What is an "advert" in MeshCore?](#24-q-what-is-an-advert-in-meshcore)
- [2.5. Q: Is there a hop limit?](#25-q-is-there-a-hop-limit)
- [3. Server Administration](#3-server-administration)
- [3.1. Q: How do you configure a repeater or a room server?](#31-q-how-do-you-configure-a-repeater-or-a-room-server)
- [3.2. Q: Do I need to set the location for a repeater?](#32-q-do-i-need-to-set-the-location-for-a-repeater)
- [3.3. Q: What is the password to administer a repeater or a room server?](#33-q-what-is-the-password-to-administer-a-repeater-or-a-room-server)
- [3.4. Q: What is the password to join a room server?](#34-q-what-is-the-password-to-join-a-room-server)
- [4. T-Deck Related](#4-t-deck-related)
- [4.1. Q: What are the steps to get a T-Deck into DFU (Device Firmware Update) mode?](#41-q-what-are-the-steps-to-get-a-t-deck-into-dfu-device-firmware-update-mode)
- [4.2. Q: Why is my T-Deck Plus not getting any satellite lock?](#42-q-why-is-my-t-deck-plus-not-getting-any-satellite-lock)
- [4.3. Q: Why is my OG (non-Plus) T-Deck not getting any satellite lock?](#43-q-why-is-my-og-non-plus-t-deck-not-getting-any-satellite-lock)
- [4.4. Q: What size of SD card does the T-Deck support?](#44-q-what-size-of-sd-card-does-the-t-deck-support)
- [4.5. Q: How do I get maps on T-Deck?](#45-q-how-do-i-get-maps-on-t-deck)
- [4.6. Q: Where do the map tiles go?](#46-q-where-do-the-map-tiles-go)
- [4.7. Q: How to unlock deeper map zoom and server management features on T-Deck?](#47-q-how-to-unlock-deeper-map-zoom-and-server-management-features-on-t-deck)
- [4.8. Q: How to decipher the diagnostics screen on T-Deck?](#48-q-how-to-decipher-the-diagnostics-screen-on-t-deck)
- [4.9. Q: The T-Deck sound is too loud?](#49-q-the-t-deck-sound-is-too-loud)
- [4.10. Q: Can you customize the sound?](#410-q-can-you-customize-the-sound)
- [4.11. Q: What is the 'Import from Clipboard' feature on the t-deck and is there a way to manually add nodes without having to receive adverts?](#411-q-what-is-the-import-from-clipboard-feature-on-the-t-deck-and-is-there-a-way-to-manually-add-nodes-without-having-to-receive-adverts)
- [5. General](#5-general)
- [5.1. Q: What are BW, SF, and CR?](#51-q-what-are-bw-sf-and-cr)
- [5.2. Q: Do MeshCore clients repeat?](#52-q-do-meshcore-clients-repeat)
- [5.3. Q: What happens when a node learns a route via a mobile repeater, and that repeater is gone?](#53-q-what-happens-when-a-node-learns-a-route-via-a-mobile-repeater-and-that-repeater-is-gone)
- [5.4. Q: How does a node discovery a path to its destination and then use it to send messages in the future, instead of flooding every message it sends like Meshtastic?](#54-q-how-does-a-node-discovery-a-path-to-its-destination-and-then-use-it-to-send-messages-in-the-future-instead-of-flooding-every-message-it-sends-like-meshtastic)
- [5.5. Q: Do public channels always flood? Do private channels always flood?](#55-q-do-public-channels-always-flood-do-private-channels-always-flood)
- [5.6. Q: what is the public key for the default public channel?](#56-q-what-is-the-public-key-for-the-default-public-channel)
- [5.7. Q: Is MeshCore open source?](#57-q-is-meshcore-open-source)
- [5.8. Q: How can I support MeshCore?](#58-q-how-can-i-support-meshcore)
- [5.9. Q: How do I build MeshCore firmware from source?](#59-q-how-do-i-build-meshcore-firmware-from-source)
- [5.10. Q: Are there other MeshCore related open source projects?](#510-q-are-there-other-meshcore-related-open-source-projects)
- [5.11. Q: Does MeshCore support ATAK](#511-q-does-meshcore-support-atak)
- [5.12. Q: How do I add a node to the MeshCore Map](#512-q-how-do-i-add-a-node-to-the-meshcore-map)
- [5.13. Q: Can I use a Raspberry Pi to update a MeshCore radio?](#513-q-can-i-use-a-raspberry-pi-to-update-a-meshcore-radio)
- [5.14. Q: Are there are projects built around MeshCore?](#514-q-are-there-are-projects-built-around-meshcore)
- [5.14.1. meshcoremqtt](#5141-meshcoremqtt)
- [5.14.2. MeshCore for Home Assistant](#5142-meshcore-for-home-assistant)
- [5.14.3. Python MeshCore](#5143-python-meshcore)
- [5.14.4. meshcore-cli](#5144-meshcore-cli)
- [5.14.5. meshcore.js](#5145-meshcorejs)
- [6. Troubleshooting](#6-troubleshooting)
- [6.1. Q: My client says another client or a repeater or a room server was last seen many, many days ago.](#61-q-my-client-says-another-client-or-a-repeater-or-a-room-server-was-last-seen-many-many-days-ago)
- [6.2. Q: A repeater or a client or a room server I expect to see on my discover list (on T-Deck) or contact list (on a smart device client) are not listed.](#62-q-a-repeater-or-a-client-or-a-room-server-i-expect-to-see-on-my-discover-list-on-t-deck-or-contact-list-on-a-smart-device-client-are-not-listed)
- [6.3. Q: How to connect to a repeater via BLE (Bluetooth)?](#63-q-how-to-connect-to-a-repeater-via-ble-bluetooth)
- [6.4. Q: I can't connect via Bluetooth, what is the Bluetooth pairing code?](#64-q-i-cant-connect-via-bluetooth-what-is-the-bluetooth-pairing-code)
- [6.5. Q: My Heltec V3 keeps disconnecting from my smartphone. It can't hold a solid Bluetooth connection.](#65-q-my-heltec-v3-keeps-disconnecting-from-my-smartphone--it-cant-hold-a-solid-bluetooth-connection)
- [7. Other Questions:](#7-other-questions)
- [7.1. Q: How to Update repeater and room server firmware over the air?](#71-q-how-to--update-repeater-and-room-server-firmware-over-the-air)
## 1. Introduction
### 1.1. Q: What is MeshCore?
**A:** MeshCore is free and open source
* MeshCore is the routing and firmware etc, available on GitHub under MIT license
* There are clients made by the community, such as the web clients, these are free to use, and some are open source too
* The cross platform mobile app developed by [Liam Cottle](https://liamcottle.net) for Android/iOS/PC etc is free to download and use
* The T-Deck firmware is developed by Scott at Ripple Radios, the creator of MeshCore, is also free to flash on your devices and use
Some more advanced, but optional features are available on T-Deck if you register your device for a key to unlock. On the MeshCore smartphone clients for Android and iOS/iPadOS, you can unlock the wait timer for repeater and room server remote management over RF feature.
These features are completely optional and aren't needed for the core messaging experience. They're like super bonus features and to help the developers continue to work on these amazing features, they may charge a small fee for an unlock code to utilise the advanced features.
Anyone is able to build anything they like on top of MeshCore without paying anything.
### 1.2. Q: What do you need to start using MeshCore?
**A:** Everything you need for MeshCore is available at:
Main web site: [https://meshcore.co.uk/](https://meshcore.co.uk/)
Firmware Flasher: https://flasher.meshcore.co.uk/
Phone Client Applications: https://meshcore.co.uk/apps.html
MeshCore Fimrware GitHub: https://github.com/ripplebiz/MeshCore
NOTE: Andy Kirby has a very useful [intro video](https://www.youtube.com/watch?v=t1qne8uJBAc) for beginners.
You need LoRa hardware devices to run MeshCore firmware as clients or server (repeater and room server).
#### 1.2.1. Hardware
To use MeshCore without using a phone as the client interface, you can run MeshCore on a T-Deck or T-Deck Plus. It is a complete off-grid secure communication solution.
MeshCore is also available on a variety of 868MHz and 915MHz LoRa devices. For example, RAK4631 devices (19003, 19007, 19026), Heltec V3, Xiao S3 WIO, Xiao C3, Heltec T114, Station G2, Seeed Studio T1000-E. More devices will be supported later.
#### 1.2.2. Firmware
MeshCore has four firmware types that are not available on other LoRa systems. MeshCore has the following:
#### 1.2.3. Companion Radio Firmware
Companion radios are for connecting to the Android app or web app as a messenger client. There are two different companion radio firmware versions:
1. **BLE Companion**
BLE Companion firmware runs on a supported LoRa device and connects to a smart device running the Android MeshCore client over BLE (iOS MeshCore client will be available soon)
<https://meshcore.co.uk/apps.html>
2. **USB Serial Companion**
USB Serial Companion firmware runs on a supported LoRa device and connects to a smart device or a computer over USB Serial running the MeshCore web client
<https://meshcore.liamcottle.net/#/>
<https://client.meshcore.co.uk/tabs/devices>
#### 1.2.4. Repeater
Repeaters are used to extend the range of a MeshCore network. Repeater firmware runs on the same devices that run client firmware. A repeater's job is to forward MeshCore packets to the destination device. It does **not** forward or retransmit every packet it receives, unlike other LoRa mesh systems.
A repeater can be remotely administered using a T-Deck running the MeshCore firmware with remote administration features unlocked, or from a BLE Companion client connected to a smartphone running the MeshCore app.
#### 1.2.5. Room Server
A room server is a simple BBS server for sharing posts. T-Deck devices running MeshCore firmware or a BLE Companion client connected to a smartphone running the MeshCore app can connect to a room server.
Room servers store message history on them and push the stored messages to users. Room servers allow roaming users to come back later and retrieve message history. With channels, messages are either received when it's sent, or not received and missed if the channel user is out of range. Room servers are different and more like email servers where you can come back later and get your emails from your mail server.
A room server can be remotely administered using a T-Deck running the MeshCore firmware with remote administration features unlocked, or from a BLE Companion client connected to a smartphone running the MeshCore app.
When a client logs into a room server, the client will receive the previously 32 unseen messages.
A room server can also take on the repeater role. To enable repeater role on a room server, use this command:
`set repeat {on|off}`
---
## 2. Initial Setup
### 2.1. Q: How many devices do I need to start using MeshCore?
**A:** If you have one supported device, flash the BLE Companion firmware and use your device as a client. You can connect to the device using the Android client via Bluetooth (iOS client will be available later). You can start communicating with other MeshCore users near you.
If you have two supported devices, and there are not many MeshCore users near you, flash both to BLE Companion firmware so you can use your devices to communicate with your near-by friends and family.
If you have two supported devices, and there are other MeshcCore users nearby, you can flash one of your devices with BLE Companion firmware and flash another supported device to repeater firmware. Place the repeater high above ground to extend your MeshCore network's reach.
After you flashed the latest firmware onto your repeater device, keep the device connected to your computer via USB serial, use the console feature on the web flasher and set the frequency for your region or country, so your client can remote administer the repeater or room server over RF:
`set freq {frequency}`
The repeater and room server CLI reference is here: https://github.com/ripplebiz/MeshCore/wiki/Repeater-&-Room-Server-CLI-Reference
If you have more supported devices, you can use your additional devices with the room server firmware.
### 2.2. Q: Does MeshCore cost any money?
**A:** All radio firmware versions (e.g. for Heltec V3, RAK, T-1000E, etc) are free and open source developed by Scott at Ripple Radios.
The native Android and iOS client uses the freemium model and is developed by Liam Cottle, developer of meshtastic map at [meshtastic.liamcottle.net](https://meshtastic.liamcottle.net) on [GitHub](https://github.com/liamcottle/meshtastic-map) and [reticulum-meshchat on github](https://github.com/liamcottle/reticulum-meshchat).
The T-Deck firmware is free to download and most features are available without cost. To support the firmware developer, you can pay for a registration key to unlock your T-Deck for deeper map zoom and remote server administration over RF using the T-Deck. You do not need to pay for the registration to use your T-Deck for direct messaging and connecting to repeaters and room servers.
### 2.3. Q: What frequencies are supported by MeshCore?
**A:** It supports the 868MHz range in the UK/EU and the 915MHz range in New Zealand, Australia, and the USA. Countries and regions in these two frequency ranges are also supported. The firmware and client allow users to set their preferred frequency.
- Australia and New Zealand are on **915.8MHz**
- UK and EU are on **869.525MHz**
- Canada and USA are on **910.525MHz**
- For other regions and countries, please check your local LoRa frequency
In UK and EU, 867.5MHz is not allowed to use 250kHz bandwidth and it only allows 2.5% duty cycle for clients. 869.525Mhz allows an airtime of 10%, 250KHz bandwidth, and a higher EIRP, therefore MeshCore nodes can send more often and with more power. That is why this frequency is chosen for UK and EU. This is also why Meshtastic also uses this frequency.
[Source]([https://](https://discord.com/channels/826570251612323860/1330643963501351004/1356540643853209641))
the rest of the radio settings are the same for all frequencies:
- Spread Factor (SF): 11
- Coding Rate (CR): 5
- Bandwidth (BW): 250.00
(Originally MeshCore started with SF 10. recently (as of late April 2025) the community has advocated SF 11 also a viable option for longer range but a little slower transmission. Currently there are MeshCore meshes with SF 10 and SF 11. Liam Cottle's smartphone app's presets now recommend SF 10 for Australia and SF 11 for all other regions and countries. EU and UK has SF 10 and SF 11 presets. Work with your local meshers on deciding with SF number is best for your use cases. In the future, there may be bridge nodes that can bridge SF 10 and SF 11 (or even different frequencies) traffic.)
### 2.4. Q: What is an "advert" in MeshCore?
**A:**
Advert means to advertise yourself on the network. In Reticulum terms it would be to announce. In Meshtastic terms it would be the node sending its node info.
MeshCore allows you to manually broadcast your name, position and public encryption key, which is also signed to prevent spoofing. When you click the advert button, it broadcasts that data over LoRa. MeshCore calls that an Advert. There's two ways to advert, "zero hop" and "flood".
* Zero hop means your advert is broadcasted out to anyone that can hear it, and that's it.
* Flooded means it's broadcasted out and then repeated by all the repeaters that hear it.
MeshCore clients only advertise themselves when the user initiates it. A repeater (and room server?) advertises its presence once every 240 minutes. This interval can be configured using the following command:
`set advert.interval {minutes}`
### 2.5. Q: Is there a hop limit?
**A:** Internally the firmware has maximum limit of 64 hops. In real world settings it will be difficult to get close to the limit due to the environments and timing as packets travel further and further. We want to hear how far your MeshCore conversations go.
---
## 3. Server Administration
### 3.1. Q: How do you configure a repeater or a room server?
**A:** - When MeshCore is flashed onto a LoRa device is for the first time, it is necessary to set the server device's frequency to make it utilize the frequency that is legal in your country or region.
Repeater or room server can be administered with one of the options below:
- After a repeater or room server firmware is flashed on to a LoRa device, go to <https://config.meshcore.dev> and use the web user interface to connect to the LoRa device via USB serial. From there you can set the name of the server, its frequency and other related settings, location, passwords etc.
![image](https://github.com/user-attachments/assets/bec28ff3-a7d6-4a1e-8602-cb6b290dd150)
- Connect the server device using a USB cable to a computer running Chrome on https://flasher.meshcore.co.uk/, then use the `console` feature to connect to the device
- Use a MeshCore smartphone clients to remotely administer servers via LoRa.
- A T-Deck running unlocked/registered MeshCore firmware. Remote server administration is enabled through registering your T-Deck with Ripple Radios. It is one of the ways to support MeshCore development. You can register your T-Deck at:
<https://buymeacoffee.com/ripplebiz/e/249834>
### 3.2. Q: Do I need to set the location for a repeater?
**A:** With location set for a repeater, it can show up on a MeshCore map in the future. Set location with the following commands:
`set lat <GPS Lat> set long <GPS Lon>`
You can get the latitude and longitude from Google Maps by right-clicking the location you are at on the map.
### 3.3. Q: What is the password to administer a repeater or a room server?
**A:** The default admin password to a repeater and room server is `password`. Use the following command to change the admin password:
`password {new-password}`
### 3.4. Q: What is the password to join a room server?
**A:** The default guest password to a room server is `hello`. Use the following command to change the guest password:
`set guest.password {guest-password}`
---
## 4. T-Deck Related
### 4.1. Q: What are the steps to get a T-Deck into DFU (Device Firmware Update) mode?
**A:**
1. Device off
2. Connect USB cable to device
3. Hold down trackball (keep holding)
4. Turn on device
5. Hear USB connection sound
6. Release trackball
7. T-Deck in DFU mode now
8. At this point you can begin flashing using <https://flasher.meshcore.co.uk/>
### 4.2. Q: Why is my T-Deck Plus not getting any satellite lock?
**A:** For T-Deck Plus, the GPS baud rate should be set to **38400**. Also, some T-Deck Plus devices were found to have the GPS module installed upside down, with the GPS antenna facing down instead of up. If your T-Deck Plus still doesn't get any satellite lock after setting the baud rate to 38400, you might need to open the device to check the GPS orientation.
GPS on T-Deck is always enabled. You can skip the "GPS clock sync" and the T-Deck will continue to try to get a GPS lock. You can go to the `GPS Info` screen; you should see the `Sentences:` counter increasing if the baud rate is correct.
[Source]([https://](https://discord.com/channels/826570251612323860/1330643963501351004/1356609240302616689))
### 4.3. Q: Why is my OG (non-Plus) T-Deck not getting any satellite lock?
**A:** The OG (non-Plus) T-Deck doesn't come with a GPS. If you added a GPS to your OG T-Deck, please refer to the manual of your GPS to see what baud rate it requires. Alternatively, you can try to set the baud rate from 9600, 19200, etc., and up to 115200 to see which one works.
### 4.4. Q: What size of SD card does the T-Deck support?
**A:** Users have had no issues using 16GB or 32GB SD cards. Format the SD card to **FAT32**.
### 4.5. Q: How do I get maps on T-Deck?
**A:** You need map tiles. You can get pre-downloaded map tiles here (a good way to support development):
- <https://buymeacoffee.com/ripplebiz/e/342543> (Europe)
- <https://buymeacoffee.com/ripplebiz/e/342542> (US)
Another way to download map tiles is to use this Python script to get the tiles in the areas you want:
<https://github.com/fistulareffigy/MTD-Script>
There is also a modified script that adds additional error handling and parallel downloads:
<https://discord.com/channels/826570251612323860/1330643963501351004/1338775811548905572>
UK map tiles are available separately from Andy Kirby on his discord server:
<https://discord.com/channels/826570251612323860/1330643963501351004/1331346597367386224>
### 4.6. Q: Where do the map tiles go?
Once you have the tiles downloaded, copy the `\tiles` folder to the root of your T-Deck's SD card.
### 4.7. Q: How to unlock deeper map zoom and server management features on T-Deck?
**A:** You can download, install, and use the T-Deck firmware for free, but it has some features (map zoom, server administration) that are enabled if you purchase an unlock code for \$10 per T-Deck device.
Unlock page: <https://buymeacoffee.com/ripplebiz/e/249834>
### 4.8. Q: How to decipher the diagnostics screen on T-Deck?
**A: ** Space is tight on T-Deck's screen, so the information is a bit cryptic. The format is :
`{hops} l:{packet-length}({payload-len}) t:{packet-type} snr:{n} rssi:{n}`
See here for packet-type: [https://github.com/ripplebiz/MeshCore/blob/main/src/Packet.h#L19](https://github.com/ripplebiz/MeshCore/blob/main/src/Packet.h#L19 "https://github.com/ripplebiz/MeshCore/blob/main/src/Packet.h#L19")
#define PAYLOAD_TYPE_REQ 0x00 // request (prefixed with dest/src hashes, MAC) (enc data: timestamp, blob)
#define PAYLOAD_TYPE_RESPONSE 0x01 // response to REQ or ANON_REQ (prefixed with dest/src hashes, MAC) (enc data: timestamp, blob)
#define PAYLOAD_TYPE_TXT_MSG 0x02 // a plain text message (prefixed with dest/src hashes, MAC) (enc data: timestamp, text)
#define PAYLOAD_TYPE_ACK 0x03 // a simple ack #define PAYLOAD_TYPE_ADVERT 0x04 // a node advertising its Identity
#define PAYLOAD_TYPE_GRP_TXT 0x05 // an (unverified) group text message (prefixed with channel hash, MAC) (enc data: timestamp, "name: msg")
#define PAYLOAD_TYPE_GRP_DATA 0x06 // an (unverified) group datagram (prefixed with channel hash, MAC) (enc data: timestamp, blob)
#define PAYLOAD_TYPE_ANON_REQ 0x07 // generic request (prefixed with dest_hash, ephemeral pub_key, MAC) (enc data: ...)
#define PAYLOAD_TYPE_PATH 0x08 // returned path (prefixed with dest/src hashes, MAC) (enc data: path, extra)
[Source](https://discord.com/channels/1343693475589263471/1343693475589263474/1350611321040932966)
### 4.9. Q: The T-Deck sound is too loud?
### 4.10. Q: Can you customize the sound?
**A:** You can customise the sounds on the T-Deck, just by placing `.mp3` files onto the `root` dir of the SD card. `startup.mp3`, `alert.mp3` and `new-advert.mp3`
### 4.11. Q: What is the 'Import from Clipboard' feature on the t-deck and is there a way to manually add nodes without having to receive adverts?
**A:** 'Import from Clipboard' is for importing a contact via a file named 'clipboard.txt' on the SD card. The opposite, is in the Identity screen, the 'Card to Clipboard' menu, which writes to 'clipboard.txt' so you can share yourself (call these 'biz cards', that start with "meshcore://...")
---
## 5. General
### 5.1. Q: What are BW, SF, and CR?
**A:**
**BW is bandwidth** - width of frequency spectrum that is used for transmission
**SF is spreading factor** - how much should the communication spread in time
**CR is coding rate** - https://www.thethingsnetwork.org/docs/lorawan/fec-and-code-rate/
Making the bandwidth 2x wider (from BW125 to BW250) allows you to send 2x more bytes in the same time. Making the spreading factor 1 step lower (from SF10 to SF9) allows you to send 2x more bytes in the same time.
Lowering the spreading factor makes it more difficult for the gateway to receive a transmission, as it will be more sensitive to noise. You could compare this to two people taking in a noisy place (a bar for example). If you’re far from each other, you have to talk slow (SF10), but if you’re close, you can talk faster (SF7)
So, it's balancing act between speed of the transmission and resistance to noise.
things network is mainly focused on LoRaWAN, but the LoRa low-level stuff still checks out for any LoRa project
### 5.2. Q: Do MeshCore clients repeat?
**A:** No, MeshCore clients do not repeat. This is the core of MeshCore's messaging-first design. This is to avoid devices flooding the air ware and create endless collisions, so messages sent aren't received.
In MeshCore, only repeaters and room server with `set repeat on` repeat.
### 5.3. Q: What happens when a node learns a route via a mobile repeater, and that repeater is gone?
**A:** If you used to reach a node through a repeater and the repeater is no longer reachable, the client will send the message using the existing (but now broken) known path, the message will fail after 3 retries, and the app will reset the path and send the message as flood on the last retry by default. This can be turned off in settings. If the destination is reachable directly or through another repeater, the new path will be used going forward. Or you can set the path manually if you know a specific repeater to use to reach that destination.
In the case if users are moving around frequently, and the paths are breaking, they just see the phone client retries and revert to flood to attempt to reestablish a path.
### 5.4. Q: How does a node discovery a path to its destination and then use it to send messages in the future, instead of flooding every message it sends like Meshtastic?
Routes are stored in sender's contact list. When you send a message the first time, the message first gets to your destination by flood routing. When your destination node gets the message, it will send back a delivery report to the sender with all repeaters that the original message went through. This delivery report is flood-routed back to you the sender and is a basis for future direct path. When you send the next message, the path will get embedded into the packet and be evaluated by repeaters. If the hop and address of the repeater matches, it will retransmit the message, otherwise it will not retransmit, hence minimizing utilization.
[Source](https://discord.com/channels/826570251612323860/1330643963501351004/1351279141630119996)
### 5.5. Q: Do public channels always flood? Do private channels always flood?
**A:** Yes, group channels are A to B, so there is no defined path. They have to flood. Repeaters can however deny flood traffic up to some hop limit, with the `set flood.max` CLI command. Administrators of repeaters get to set the rules of their repeaters.
[Source](https://discord.com/channels/1343693475589263471/1343693475589263474/1350023009527664672)
### 5.6. Q: what is the public key for the default public channel?
**A:** The smartphone app key is in hex:
` 8b3387e9c5cdea6ac9e5edbaa115cd72`
T-Deck uses the same key but in base64
`izOH6cXN6mrJ5e26oRXNcg==`
The third character is the capital letter 'O', not zero `0`
[Source](https://discord.com/channels/826570251612323860/1330643963501351004/1354194409213792388)
### 5.7. Q: Is MeshCore open source?
**A:** Most of the firmware is freely available. Everything is open source except the T-Deck firmware and Liam's native mobile apps.
- Firmware repo: <https://github.com/ripplebiz/MeshCore>
### 5.8. Q: How can I support MeshCore?
**A:** Provide your honest feedback on GitHub and on AndyKirby's Discord server <http://discord.com/invite/H62Re4DCeD>. Spread the word of MeshCore to your friends and communities; help them get started with MeshCore. Support Scott's MeshCore development at <https://buymeacoffee.com/ripplebiz>.
Support Liam Cottle's smartphone client development by unlocking the server administration wait gate with in-app purchase
Support Rastislav Vysoky (recrof)'s flasher web site and the map web site development through [PayPal](https://www.paypal.com/donate/?business=DREHF5HM265ES&no_recurring=0&item_name=If+you+enjoy+my+work%2C+you+can+support+me+here%3A&currency_code=EUR) or [Revolut](https://revolut.me/recrof)
### 5.9. Q: How do I build MeshCore firmware from source?
**A:** See instructions here:
https://discord.com/channels/826570251612323860/1330643963501351004/1341826372120608769
Build instructions for MeshCore:
For Windows, first install WSL and Python+pip via: https://plainenglish.io/blog/setting-up-python-on-windows-subsystem-for-linux-wsl-26510f1b2d80
(Linux, Windows+WSL) In the terminal/shell:
```
sudo apt update
sudo apt install libpython3-dev
sudo apt install python3-venv
```
Mac: python3 should be already installed.
Then it should be the same for all platforms:
```
python3 -m venv meshcore
cd meshcore && source bin/activate
pip install -U platformio
git clone https://github.com/ripplebiz/MeshCore.git
cd MeshCore
```
open platformio.ini and in `[arduino_base]` edit the `LORA_FREQ=867.5`
save, then run:
```
pio run -e RAK_4631_Repeater
```
then you'll find `firmware.zip` in `.pio/build/RAK_4631_Repeater`
Andy also has a video on how to build using VS Code:
*How to build and flash Meshcore repeater firmware | Heltec V3*
<https://www.youtube.com/watch?v=WJvg6dt13hk> *(Link referenced in the Discord post)*
### 5.10. Q: Are there other MeshCore related open source projects?
**A:** [Liam Cottle](https://liamcottle.net)'s MeshCore web client and MeshCore Javascript libary are open source under MIT license.
Web client: https://github.com/liamcottle/meshcore-web
Javascript: https://github.com/liamcottle/meshcore.js
### 5.11. Q: Does MeshCore support ATAK
**A:** ATAK is not currently on MeshCore's roadmap.
Meshcore would not be best suited to ATAK because MeshCore:
clients do not repeat and therefore you would need a network of repeaters in place
will not have a stable path where all clients are constantly moving between repeaters
MeshCore clients would need to reset path constantly and flood traffic across the network which could lead to lots of collisions with something as chatty as ATAK.
This could change in the future if MeshCore develops a client firmware that repeats.
[Source](https://discord.com/channels/826570251612323860/1330643963501351004/1354780032140054659)
### 5.12. Q: How do I add a node to the [MeshCore Map]([url](https://meshcore.co.uk/map.html))
**A:** From the smartphone app, connect to a BLE Companion radio
- To add the BLE Companion radio your smartphone is connected to to the map, tap the `advert` icon, then tap `Advert (To Clipboard)`.
- To add a Repeater or Room Server to the map, tap the 3 dots next to the Repeater or Room Server you want to add to the map, then tap `Share (To Clipboard)`.
- Go to the [MeshCore Map web site]([url](https://meshcore.co.uk/map.html)), tap the plus sign on the lower right corner and paste in the meshcore://... blob, then tap `Add Node`
### 5.13. Q: Can I use a Raspberry Pi to update a MeshCore radio?
** A:** Yes.
You will need to install picocom on the pi.
`sudo apt install picocom`
Then run the following commands to setup the repeater.
```
picocom -b 115200 /dev/ttyUSB0 --imap lfcrlf
set name your_repeater_name
time epoch_time
password your_unique_password
set advert.interval 240
advert
```
Note: If using a RAK the path will most likely be /dev/ttyACM0
Epoch time comes from https://www.epochconverter.com/
You can also flash the repeater using esptool. You will need to install esptool with the following command...
`pip install esptool --break-system-packages`
Then to flash the firmware to Heltec, obtain the .bin file from https://flasher.meshcore.co.uk/ (download all firmware link)
For Heltec:
`esptool.py -p /dev/ttyUSB0 --chip esp32-s3 write_flash 0x00000 firmware.bin`
If flashing a visual studio code build bin file, flash with the following offset:
`esptool.py -p /dev/ttyUSB0 --chip esp32-s3 write_flash 0x10000 firmware.bin`
For Pi
Download the zip from the online flasher website and use the following command:
Note: Requires adafruit-nrfutil command which can be installed as follows.
`pip install adafruit-nrfutil --break-system-packages`
```
adafruit-nrfutil --verbose dfu serial --package t1000_e_bootloader-0.9.1-5-g488711a_s140_7.3.0.zip -p /dev/ttyACM0 -b 115200 --singlebank --touch 1200
```
[Source](https://discord.com/channels/826570251612323860/1330643963501351004/1342120825251299388)
### 5.14. Q: Are there are projects built around MeshCore?
**A:** Yes. See the following:
#### 5.14.1. meshcoremqtt
A Python script to send meshore debug and packet capture data to MQTT for analysis
https://github.com/Andrew-a-g/meshcoretomqtt
#### 5.14.2. MeshCore for Home Assistant
A custom Home Assistant integration for MeshCore mesh radio nodes. It allows you to monitor and control MeshCore nodes via USB, BLE, or TCP connections.
https://github.com/awolden/meshcore-ha
#### 5.14.3. Python MeshCore
Bindings to access your MeshCore companion radio nodes in python.
https://github.com/fdlamotte/meshcore_py
#### 5.14.4. meshcore-cli
CLI interface to MeshCore companion radio over BLE, TCP, or serial. Uses Pyton MeshCore above.
https://github.com/fdlamotte/meshcore-cli
#### 5.14.5. meshcore.js
A JavaScript library for interacting with a MeshCore device running the companion radio firmware
https://github.com/liamcottle/meshcore.js
---
## 6. Troubleshooting
### 6.1. Q: My client says another client or a repeater or a room server was last seen many, many days ago.
### 6.2. Q: A repeater or a client or a room server I expect to see on my discover list (on T-Deck) or contact list (on a smart device client) are not listed.
**A:**
- If your client is a T-Deck, it may not have its time set (no GPS installed, no GPS lock, or wrong GPS baud rate).
- If you are using the Android or iOS client, the other client, repeater, or room server may have the wrong time.
You can get the epoch time on <https://www.epochconverter.com/> and use it to set your T-Deck clock. For a repeater and room server, the admin can use a T-Deck to remotely set their clock (clock sync), or use the `time` command in the USB serial console with the server device connected.
### 6.3. Q: How to connect to a repeater via BLE (Bluetooth)?
**A:** You can't connect to a device running repeater firmware via Bluetooth. Devices running the BLE companion firmware you can connect to it via Bluetooth using the android app
### 6.4. Q: I can't connect via Bluetooth, what is the Bluetooth pairing code?
**A:** the default Bluetooth pairing code is `123456`
### 6.5. Q: My Heltec V3 keeps disconnecting from my smartphone. It can't hold a solid Bluetooth connection.
**A:** Heltec V3 has a very small coil antenna on its PCB for Wi-Fi and Bluetooth connectivity. It has a very short range, only a few feet. It is possible to remove the coil antenna and replace it with a 31mm wire. The BT range is much improved with the modification.
---
## 7. Other Questions:
### 7.1. Q: How to Update repeater and room server firmware over the air?
**A:** Only nRF-based RAK4631 and Heltec T114 OTA firmware update are verified using nRF smartphone app. Lilygo T-Echo doesn't work currently.
You can update repeater and room server firmware with a Bluetooth connection between your smartphone and your LoRa radio using the nRF app.
1. Download the ZIP file for the specific node from the web flasher to your smartphone
2. On the phone client, log on to the repeater as administrator (default password is `password`) to issue the `start ota`command to the repeater or room server to get the device into OTA DFU mode
![image](https://github.com/user-attachments/assets/889bb81b-7214-4a1c-955a-396b5a05d8ad)
1. `start ota` can be initiated from USB serial console on the web flasher page or a T-Deck
4. On the smartphone, download and run the nRF app and scan for Bluetooth devices
5. Connect to the repeater/room server node you want to update
1. nRF app is available on both Android and iOS
**Android continues after the iOS section:**
**iOS continues here:**
5. Once connected successfully, a `DFU` icon ![Pasted image 20250309173039](https://github.com/user-attachments/assets/af7a9f78-8739-4946-b734-02bade9c8e71)
appears in the top right corner of the app
![Pasted image 20250309171919](https://github.com/user-attachments/assets/08007ec8-4924-49c1-989f-ca2611e78793)
6. Scroll down to change the `PRN(s)` number:
![Pasted image 20250309190158](https://github.com/user-attachments/assets/11f69cdd-12f3-4696-a6fc-14a78c85fe32)
- For the T114, change the number of packets `(PRN(s)` to 8
- For RAK, it can be 10, but it also works on 8.
7. Click the `DFU` icon ![Pasted image 20250309173039](https://github.com/user-attachments/assets/af7a9f78-8739-4946-b734-02bade9c8e71), select the type of file to upload (choose ZIP), then select the ZIP file that was downloaded earlier from the web flasher
8. The upload process will start now. If everything goes well, the node resets and is flashed successfully.
![Pasted image 20250309190342](https://github.com/user-attachments/assets/a60e25d0-33b8-46cf-af90-20a7d8ac2adb)
**Android steps continues below:**
1. on the top left corner of the nRF Connect app on Android, tap the 3-bar hamburger menu, then `Settings`, then `nRF5 DFU Options`
![Android nRF Hamberger](https://github.com/user-attachments/assets/ea6dfeef-9367-4830-bd70-1441d517c706)
![Android nRF Settings](https://github.com/user-attachments/assets/c63726bf-cecd-4987-be68-afb6358c7190)
![Android nRF DFU Options](https://github.com/user-attachments/assets/b20e872f-5122-41d9-90df-0215cff5fbc9)
2. Change `Number of packets` to `10` for RAK, `8` for Heltec T114
![Android nRF Number of Packets](https://github.com/user-attachments/assets/c092adaf-4cb3-460b-b7ef-8d7f450d602b)
3. Go back to the main screen
4. Your LoRa device should already ben in DFU mode from previous steps
5. tap `SCANNER` and then `SCAN` to find the device you want to update, tap `CONNECT`
![Android nRF Scanner Scan Connect](https://github.com/user-attachments/assets/37218717-f167-48b6-a6ca-93d132ef77ca)
6. On the top left corner of the nRF Connect app, tap the `DFU` icon next to the three dots
![Android nRF DFU](https://github.com/user-attachments/assets/1ec3b818-bf0c-461f-8fdf-37c41a63cafa)
7. Choose `Distribution packet (ZIP)` and then `OK`
![Android nRF Distribution Packet (ZIP)](https://github.com/user-attachments/assets/e65f5616-9793-44f5-95c0-a3eb15aa7152)
8. Choose the firmware file in ZIP formate that you downloaded earlier from the MeshCore web flasher, update will start as soon as you tap the file
![Android nRF FW Updating](https://github.com/user-attachments/assets/0814d123-85ce-4c87-90a7-e1a25dc71900)
9. When the update process is done, the device will disconnect from nRF app and the LoRa device is updated
---
+27
View File
@@ -0,0 +1,27 @@
#ifndef NODE_PREFS_H
#define NODE_PREFS_H
#include <cstdint> // For uint8_t, uint32_t
#define TELEM_MODE_DENY 0
#define TELEM_MODE_ALLOW_FLAGS 1 // use contact.flags
#define TELEM_MODE_ALLOW_ALL 2
struct NodePrefs { // persisted to file
float airtime_factor;
char node_name[32];
float freq;
uint8_t sf;
uint8_t cr;
uint8_t reserved1;
uint8_t manual_add_contacts;
float bw;
uint8_t tx_power_dbm;
uint8_t telemetry_mode_base;
uint8_t telemetry_mode_loc;
uint8_t telemetry_mode_env;
float rx_delay_base;
uint32_t ble_pin;
};
#endif // NODE_PREFS_H
+306
View File
@@ -0,0 +1,306 @@
#include "UITask.h"
#include <Arduino.h>
#include <helpers/TxtDataHelpers.h>
#include "NodePrefs.h"
#define AUTO_OFF_MILLIS 15000 // 15 seconds
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds
#ifdef PIN_STATUS_LED
#define LED_ON_MILLIS 20
#define LED_ON_MSG_MILLIS 200
#define LED_CYCLE_MILLIS 4000
#endif
#ifndef USER_BTN_PRESSED
#define USER_BTN_PRESSED LOW
#endif
// 'meshcore', 128x13px
static const uint8_t meshcore_logo [] PROGMEM = {
0x3c, 0x01, 0xe3, 0xff, 0xc7, 0xff, 0x8f, 0x03, 0x87, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe,
0x3c, 0x03, 0xe3, 0xff, 0xc7, 0xff, 0x8e, 0x03, 0x8f, 0xfe, 0x3f, 0xfe, 0x1f, 0xff, 0x1f, 0xfe,
0x3e, 0x03, 0xc3, 0xff, 0x8f, 0xff, 0x0e, 0x07, 0x8f, 0xfe, 0x7f, 0xfe, 0x1f, 0xff, 0x1f, 0xfc,
0x3e, 0x07, 0xc7, 0x80, 0x0e, 0x00, 0x0e, 0x07, 0x9e, 0x00, 0x78, 0x0e, 0x3c, 0x0f, 0x1c, 0x00,
0x3e, 0x0f, 0xc7, 0x80, 0x1e, 0x00, 0x0e, 0x07, 0x1e, 0x00, 0x70, 0x0e, 0x38, 0x0f, 0x3c, 0x00,
0x7f, 0x0f, 0xc7, 0xfe, 0x1f, 0xfc, 0x1f, 0xff, 0x1c, 0x00, 0x70, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
0x7f, 0x1f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
0x7f, 0x3f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x1e, 0x3f, 0xfe, 0x3f, 0xf0,
0x77, 0x3b, 0x87, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xfc, 0x38, 0x00,
0x77, 0xfb, 0x8f, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xf8, 0x38, 0x00,
0x73, 0xf3, 0x8f, 0xff, 0x0f, 0xff, 0x1c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x78, 0x7f, 0xf8,
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfe, 0x3c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x3c, 0x7f, 0xf8,
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
};
void UITask::begin(DisplayDriver* display, NodePrefs* node_prefs, const char* build_date, const char* firmware_version, uint32_t pin_code) {
_display = display;
_auto_off = millis() + AUTO_OFF_MILLIS;
clearMsgPreview();
_node_prefs = node_prefs;
_pin_code = pin_code;
if (_display != NULL) {
_display->turnOn();
}
// strip off dash and commit hash by changing dash to null terminator
// e.g: v1.2.3-abcdef -> v1.2.3
char *version = strdup(firmware_version);
char *dash = strchr(version, '-');
if(dash){
*dash = 0;
}
// v1.2.3 (1 Jan 2025)
sprintf(_version_info, "%s (%s)", version, build_date);
#ifdef PIN_BUZZER
buzzer.begin();
#endif
}
void UITask::soundBuzzer(UIEventType bet) {
#if defined(PIN_BUZZER)
switch(bet){
case UIEventType::contactMessage:
// gemini's pick
buzzer.play("MsgRcv3:d=4,o=6,b=200:32e,32g,32b,16c7");
break;
case UIEventType::channelMessage:
buzzer.play("kerplop:d=16,o=6,b=120:32g#,32c#");
break;
case UIEventType::roomMessage:
case UIEventType::newContactMessage:
case UIEventType::none:
default:
break;
}
#endif
// Serial.print("DBG: Buzzzzzz -> ");
// Serial.println((int) bet);
}
void UITask::msgRead(int msgcount) {
_msgcount = msgcount;
if (msgcount == 0) {
clearMsgPreview();
}
}
void UITask::clearMsgPreview() {
_origin[0] = 0;
_msg[0] = 0;
_need_refresh = true;
}
void UITask::newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount) {
_msgcount = msgcount;
if (path_len == 0xFF) {
sprintf(_origin, "(F) %s", from_name);
} else {
sprintf(_origin, "(%d) %s", (uint32_t) path_len, from_name);
}
StrHelper::strncpy(_msg, text, sizeof(_msg));
if (_display != NULL) {
if (!_display->isOn()) _display->turnOn();
_auto_off = millis() + AUTO_OFF_MILLIS; // extend the auto-off timer
_need_refresh = true;
}
}
void UITask::renderBatteryIndicator(uint16_t batteryMilliVolts) {
// Convert millivolts to percentage
const int minMilliVolts = 3000; // Minimum voltage (e.g., 3.0V)
const int maxMilliVolts = 4200; // Maximum voltage (e.g., 4.2V)
int batteryPercentage = ((batteryMilliVolts - minMilliVolts) * 100) / (maxMilliVolts - minMilliVolts);
if (batteryPercentage < 0) batteryPercentage = 0; // Clamp to 0%
if (batteryPercentage > 100) batteryPercentage = 100; // Clamp to 100%
// battery icon
int iconWidth = 24;
int iconHeight = 12;
int iconX = _display->width() - iconWidth - 5; // Position the icon near the top-right corner
int iconY = 0;
_display->setColor(DisplayDriver::GREEN);
// battery outline
_display->drawRect(iconX, iconY, iconWidth, iconHeight);
// battery "cap"
_display->fillRect(iconX + iconWidth, iconY + (iconHeight / 4), 3, iconHeight / 2);
// fill the battery based on the percentage
int fillWidth = (batteryPercentage * (iconWidth - 4)) / 100;
_display->fillRect(iconX + 2, iconY + 2, fillWidth, iconHeight - 4);
}
void UITask::renderCurrScreen() {
if (_display == NULL) return; // assert() ??
char tmp[80];
if (_origin[0] && _msg[0]) { // message preview
// render message preview
_display->setCursor(0, 0);
_display->setTextSize(1);
_display->setColor(DisplayDriver::GREEN);
_display->print(_node_prefs->node_name);
_display->setCursor(0, 12);
_display->setColor(DisplayDriver::YELLOW);
_display->print(_origin);
_display->setCursor(0, 24);
_display->setColor(DisplayDriver::LIGHT);
_display->print(_msg);
_display->setCursor(_display->width() - 28, 9);
_display->setTextSize(2);
_display->setColor(DisplayDriver::ORANGE);
sprintf(tmp, "%d", _msgcount);
_display->print(tmp);
_display->setColor(DisplayDriver::YELLOW); // last color will be kept on T114
} else if (millis() < BOOT_SCREEN_MILLIS) { // boot screen
// meshcore logo
_display->setColor(DisplayDriver::BLUE);
int logoWidth = 128;
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
// version info
_display->setColor(DisplayDriver::LIGHT);
_display->setTextSize(1);
uint16_t textWidth = _display->getTextWidth(_version_info);
_display->setCursor((_display->width() - textWidth) / 2, 22);
_display->print(_version_info);
} else { // home screen
// node name
_display->setCursor(0, 0);
_display->setTextSize(1);
_display->setColor(DisplayDriver::GREEN);
_display->print(_node_prefs->node_name);
// battery voltage
renderBatteryIndicator(_board->getBattMilliVolts());
// freq / sf
_display->setCursor(0, 20);
_display->setColor(DisplayDriver::YELLOW);
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
_display->print(tmp);
// bw / cr
_display->setCursor(0, 30);
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
_display->print(tmp);
// BT pin
if (!_connected && _pin_code != 0) {
_display->setColor(DisplayDriver::RED);
_display->setTextSize(2);
_display->setCursor(0, 43);
sprintf(tmp, "Pin:%d", _pin_code);
_display->print(tmp);
_display->setColor(DisplayDriver::GREEN);
} else {
_display->setColor(DisplayDriver::LIGHT);
}
}
_need_refresh = false;
}
void UITask::userLedHandler() {
#ifdef PIN_STATUS_LED
static int state = 0;
static int next_change = 0;
static int last_increment = 0;
int cur_time = millis();
if (cur_time > next_change) {
if (state == 0) {
state = 1;
if (_msgcount > 0) {
last_increment = LED_ON_MSG_MILLIS;
} else {
last_increment = LED_ON_MILLIS;
}
next_change = cur_time + last_increment;
} else {
state = 0;
next_change = cur_time + LED_CYCLE_MILLIS - last_increment;
}
digitalWrite(PIN_STATUS_LED, state);
}
#endif
}
void UITask::buttonHandler() {
#if defined(PIN_USER_BTN) || defined(PIN_USER_BTN_ANA)
static int prev_btn_state = !USER_BTN_PRESSED;
static int prev_btn_state_ana = !USER_BTN_PRESSED;
static unsigned long btn_state_change_time = 0;
static unsigned long next_read = 0;
int cur_time = millis();
if (cur_time >= next_read) {
int btn_state = 0;
int btn_state_ana = 0;
#ifdef PIN_USER_BTN
btn_state = digitalRead(PIN_USER_BTN);
#endif
#ifdef PIN_USER_BTN_ANA
btn_state_ana = (analogRead(PIN_USER_BTN_ANA) < 20); // analogRead returns a value hopefully below 20 when button is pressed.
#endif
if (btn_state != prev_btn_state || btn_state_ana != prev_btn_state_ana) { // check for either digital or analogue button change of state
if (btn_state == USER_BTN_PRESSED || btn_state_ana == USER_BTN_PRESSED) { // pressed?
if (_display != NULL) {
if (_display->isOn()) {
clearMsgPreview();
} else {
_display->turnOn();
_need_refresh = true;
}
_auto_off = cur_time + AUTO_OFF_MILLIS; // extend auto-off timer
}
} else { // unpressed ? check pressed time ...
if ((cur_time - btn_state_change_time) > 5000) {
#ifdef PIN_STATUS_LED
digitalWrite(PIN_STATUS_LED, LOW);
delay(10);
#endif
_board->powerOff();
}
}
btn_state_change_time = millis();
prev_btn_state = btn_state;
prev_btn_state_ana = btn_state_ana;
}
next_read = millis() + 100; // 10 reads per second
}
#endif
}
void UITask::loop() {
buttonHandler();
userLedHandler();
#ifdef PIN_BUZZER
if (buzzer.isPlaying()) buzzer.loop();
#endif
if (_display != NULL && _display->isOn()) {
static bool _firstBoot = true;
if(_firstBoot && millis() >= BOOT_SCREEN_MILLIS) {
_need_refresh = true;
_firstBoot = false;
}
if (millis() >= _next_refresh && _need_refresh) {
_display->startFrame();
renderCurrScreen();
_display->endFrame();
_next_refresh = millis() + 1000; // refresh every second
}
if (millis() > _auto_off) {
_display->turnOff();
}
}
}
+59
View File
@@ -0,0 +1,59 @@
#pragma once
#include <MeshCore.h>
#include <helpers/ui/DisplayDriver.h>
#include <stddef.h>
#ifdef PIN_BUZZER
#include <helpers/ui/buzzer.h>
#endif
#include "NodePrefs.h"
enum class UIEventType
{
none,
contactMessage,
channelMessage,
roomMessage,
newContactMessage
};
class UITask {
DisplayDriver* _display;
mesh::MainBoard* _board;
#ifdef PIN_BUZZER
genericBuzzer buzzer;
#endif
unsigned long _next_refresh, _auto_off;
bool _connected;
uint32_t _pin_code;
NodePrefs* _node_prefs;
char _version_info[32];
char _origin[62];
char _msg[80];
int _msgcount;
bool _need_refresh = true;
void renderCurrScreen();
void buttonHandler();
void userLedHandler();
void renderBatteryIndicator(uint16_t batteryMilliVolts);
public:
UITask(mesh::MainBoard* board) : _board(board), _display(NULL) {
_next_refresh = 0;
_connected = false;
}
void begin(DisplayDriver* display, NodePrefs* node_prefs, const char* build_date, const char* firmware_version, uint32_t pin_code);
void setHasConnection(bool connected) { _connected = connected; }
bool hasDisplay() const { return _display != NULL; }
void clearMsgPreview();
void msgRead(int msgcount);
void newMsg(uint8_t path_len, const char* from_name, const char* text, int msgcount);
void soundBuzzer(UIEventType bet = UIEventType::none);
void loop();
};
File diff suppressed because it is too large. Load diff
+114
View File
@@ -0,0 +1,114 @@
#include "UITask.h"
#include <Arduino.h>
#include <helpers/CommonCLI.h>
#define AUTO_OFF_MILLIS 20000 // 20 seconds
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds
// 'meshcore', 128x13px
static const uint8_t meshcore_logo [] PROGMEM = {
0x3c, 0x01, 0xe3, 0xff, 0xc7, 0xff, 0x8f, 0x03, 0x87, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe,
0x3c, 0x03, 0xe3, 0xff, 0xc7, 0xff, 0x8e, 0x03, 0x8f, 0xfe, 0x3f, 0xfe, 0x1f, 0xff, 0x1f, 0xfe,
0x3e, 0x03, 0xc3, 0xff, 0x8f, 0xff, 0x0e, 0x07, 0x8f, 0xfe, 0x7f, 0xfe, 0x1f, 0xff, 0x1f, 0xfc,
0x3e, 0x07, 0xc7, 0x80, 0x0e, 0x00, 0x0e, 0x07, 0x9e, 0x00, 0x78, 0x0e, 0x3c, 0x0f, 0x1c, 0x00,
0x3e, 0x0f, 0xc7, 0x80, 0x1e, 0x00, 0x0e, 0x07, 0x1e, 0x00, 0x70, 0x0e, 0x38, 0x0f, 0x3c, 0x00,
0x7f, 0x0f, 0xc7, 0xfe, 0x1f, 0xfc, 0x1f, 0xff, 0x1c, 0x00, 0x70, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
0x7f, 0x1f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
0x7f, 0x3f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x1e, 0x3f, 0xfe, 0x3f, 0xf0,
0x77, 0x3b, 0x87, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xfc, 0x38, 0x00,
0x77, 0xfb, 0x8f, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xf8, 0x38, 0x00,
0x73, 0xf3, 0x8f, 0xff, 0x0f, 0xff, 0x1c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x78, 0x7f, 0xf8,
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfe, 0x3c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x3c, 0x7f, 0xf8,
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
};
void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version) {
_prevBtnState = HIGH;
_auto_off = millis() + AUTO_OFF_MILLIS;
_node_prefs = node_prefs;
_display->turnOn();
// strip off dash and commit hash by changing dash to null terminator
// e.g: v1.2.3-abcdef -> v1.2.3
char *version = strdup(firmware_version);
char *dash = strchr(version, '-');
if(dash){
*dash = 0;
}
// v1.2.3 (1 Jan 2025)
sprintf(_version_info, "%s (%s)", version, build_date);
}
void UITask::renderCurrScreen() {
char tmp[80];
if (millis() < BOOT_SCREEN_MILLIS) { // boot screen
// meshcore logo
_display->setColor(DisplayDriver::BLUE);
int logoWidth = 128;
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
// version info
_display->setColor(DisplayDriver::LIGHT);
_display->setTextSize(1);
uint16_t versionWidth = _display->getTextWidth(_version_info);
_display->setCursor((_display->width() - versionWidth) / 2, 22);
_display->print(_version_info);
// node type
const char* node_type = "< Repeater >";
uint16_t typeWidth = _display->getTextWidth(node_type);
_display->setCursor((_display->width() - typeWidth) / 2, 35);
_display->print(node_type);
} else { // home screen
// node name
_display->setCursor(0, 0);
_display->setTextSize(1);
_display->setColor(DisplayDriver::GREEN);
_display->print(_node_prefs->node_name);
// freq / sf
_display->setCursor(0, 20);
_display->setColor(DisplayDriver::YELLOW);
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
_display->print(tmp);
// bw / cr
_display->setCursor(0, 30);
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
_display->print(tmp);
}
}
void UITask::loop() {
#ifdef PIN_USER_BTN
if (millis() >= _next_read) {
int btnState = digitalRead(PIN_USER_BTN);
if (btnState != _prevBtnState) {
if (btnState == LOW) { // pressed?
if (_display->isOn()) {
// TODO: any action ?
} else {
_display->turnOn();
}
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
}
_prevBtnState = btnState;
}
_next_read = millis() + 200; // 5 reads per second
}
#endif
if (_display->isOn()) {
if (millis() >= _next_refresh) {
_display->startFrame();
renderCurrScreen();
_display->endFrame();
_next_refresh = millis() + 1000; // refresh every second
}
if (millis() > _auto_off) {
_display->turnOff();
}
}
}
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include <helpers/ui/DisplayDriver.h>
#include <helpers/CommonCLI.h>
class UITask {
DisplayDriver* _display;
unsigned long _next_read, _next_refresh, _auto_off;
int _prevBtnState;
NodePrefs* _node_prefs;
char _version_info[32];
void renderCurrScreen();
public:
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version);
void loop();
};
+816
View File
@@ -0,0 +1,816 @@
#include <Arduino.h> // needed for PlatformIO
#include <Mesh.h>
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
#include <InternalFileSystem.h>
#elif defined(RP2040_PLATFORM)
#include <LittleFS.h>
#elif defined(ESP32)
#include <SPIFFS.h>
#endif
#include <helpers/ArduinoHelpers.h>
#include <helpers/StaticPoolPacketManager.h>
#include <helpers/SimpleMeshTables.h>
#include <helpers/IdentityStore.h>
#include <helpers/AdvertDataHelpers.h>
#include <helpers/TxtDataHelpers.h>
#include <helpers/CommonCLI.h>
#include <RTClib.h>
#include <target.h>
/* ------------------------------ Config -------------------------------- */
#ifndef FIRMWARE_BUILD_DATE
#define FIRMWARE_BUILD_DATE "24 May 2025"
#endif
#ifndef FIRMWARE_VERSION
#define FIRMWARE_VERSION "v1.6.2"
#endif
#ifndef LORA_FREQ
#define LORA_FREQ 915.0
#endif
#ifndef LORA_BW
#define LORA_BW 250
#endif
#ifndef LORA_SF
#define LORA_SF 10
#endif
#ifndef LORA_CR
#define LORA_CR 5
#endif
#ifndef LORA_TX_POWER
#define LORA_TX_POWER 20
#endif
#ifndef ADVERT_NAME
#define ADVERT_NAME "repeater"
#endif
#ifndef ADVERT_LAT
#define ADVERT_LAT 0.0
#endif
#ifndef ADVERT_LON
#define ADVERT_LON 0.0
#endif
#ifndef ADMIN_PASSWORD
#define ADMIN_PASSWORD "password"
#endif
#ifdef DISPLAY_CLASS
#include "UITask.h"
static UITask ui_task(display);
#endif
#define FIRMWARE_ROLE "repeater"
#define PACKET_LOG_FILE "/packet_log"
/* ------------------------------ Code -------------------------------- */
#define REQ_TYPE_GET_STATUS 0x01 // same as _GET_STATS
#define REQ_TYPE_KEEP_ALIVE 0x02
#define REQ_TYPE_GET_TELEMETRY_DATA 0x03
#define RESP_SERVER_LOGIN_OK 0 // response to ANON_REQ
struct RepeaterStats {
uint16_t batt_milli_volts;
uint16_t curr_tx_queue_len;
uint16_t curr_free_queue_len;
int16_t last_rssi;
uint32_t n_packets_recv;
uint32_t n_packets_sent;
uint32_t total_air_time_secs;
uint32_t total_up_time_secs;
uint32_t n_sent_flood, n_sent_direct;
uint32_t n_recv_flood, n_recv_direct;
uint16_t err_events; // was 'n_full_events'
int16_t last_snr; // x 4
uint16_t n_direct_dups, n_flood_dups;
};
struct ClientInfo {
mesh::Identity id;
uint32_t last_timestamp, last_activity;
uint8_t secret[PUB_KEY_SIZE];
bool is_admin;
int8_t out_path_len;
uint8_t out_path[MAX_PATH_SIZE];
};
#ifndef MAX_CLIENTS
#define MAX_CLIENTS 32
#endif
struct NeighbourInfo {
mesh::Identity id;
uint32_t advert_timestamp;
uint32_t heard_timestamp;
int8_t snr; // multiplied by 4, user should divide to get float value
};
// NOTE: need to space the ACK and the reply text apart (in CLI)
#define CLI_REPLY_DELAY_MILLIS 1500
class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
FILESYSTEM* _fs;
unsigned long next_local_advert, next_flood_advert;
bool _logging;
NodePrefs _prefs;
CommonCLI _cli;
uint8_t reply_data[MAX_PACKET_PAYLOAD];
ClientInfo known_clients[MAX_CLIENTS];
#if MAX_NEIGHBOURS
NeighbourInfo neighbours[MAX_NEIGHBOURS];
#endif
CayenneLPP telemetry;
ClientInfo* putClient(const mesh::Identity& id) {
uint32_t min_time = 0xFFFFFFFF;
ClientInfo* oldest = &known_clients[0];
for (int i = 0; i < MAX_CLIENTS; i++) {
if (known_clients[i].last_activity < min_time) {
oldest = &known_clients[i];
min_time = oldest->last_activity;
}
if (id.matches(known_clients[i].id)) return &known_clients[i]; // already known
}
oldest->id = id;
oldest->out_path_len = -1; // initially out_path is unknown
oldest->last_timestamp = 0;
self_id.calcSharedSecret(oldest->secret, id); // calc ECDH shared secret
return oldest;
}
void putNeighbour(const mesh::Identity& id, uint32_t timestamp, float snr) {
#if MAX_NEIGHBOURS // check if neighbours enabled
// find existing neighbour, else use least recently updated
uint32_t oldest_timestamp = 0xFFFFFFFF;
NeighbourInfo* neighbour = &neighbours[0];
for (int i = 0; i < MAX_NEIGHBOURS; i++) {
// if neighbour already known, we should update it
if (id.matches(neighbours[i].id)) {
neighbour = &neighbours[i];
break;
}
// otherwise we should update the least recently updated neighbour
if (neighbours[i].heard_timestamp < oldest_timestamp) {
neighbour = &neighbours[i];
oldest_timestamp = neighbour->heard_timestamp;
}
}
// update neighbour info
neighbour->id = id;
neighbour->advert_timestamp = timestamp;
neighbour->heard_timestamp = getRTCClock()->getCurrentTime();
neighbour->snr = (int8_t) (snr * 4);
#endif
}
int handleRequest(ClientInfo* sender, uint32_t sender_timestamp, uint8_t* payload, size_t payload_len) {
// uint32_t now = getRTCClock()->getCurrentTimeUnique();
// memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
memcpy(reply_data, &sender_timestamp, 4); // reflect sender_timestamp back in response packet (kind of like a 'tag')
switch (payload[0]) {
case REQ_TYPE_GET_STATUS: { // guests can also access this now
RepeaterStats stats;
stats.batt_milli_volts = board.getBattMilliVolts();
stats.curr_tx_queue_len = _mgr->getOutboundCount(0xFFFFFFFF);
stats.curr_free_queue_len = _mgr->getFreeCount();
stats.last_rssi = (int16_t) radio_driver.getLastRSSI();
stats.n_packets_recv = radio_driver.getPacketsRecv();
stats.n_packets_sent = radio_driver.getPacketsSent();
stats.total_air_time_secs = getTotalAirTime() / 1000;
stats.total_up_time_secs = _ms->getMillis() / 1000;
stats.n_sent_flood = getNumSentFlood();
stats.n_sent_direct = getNumSentDirect();
stats.n_recv_flood = getNumRecvFlood();
stats.n_recv_direct = getNumRecvDirect();
stats.err_events = _err_flags;
stats.last_snr = (int16_t)(radio_driver.getLastSNR() * 4);
stats.n_direct_dups = ((SimpleMeshTables *)getTables())->getNumDirectDups();
stats.n_flood_dups = ((SimpleMeshTables *)getTables())->getNumFloodDups();
memcpy(&reply_data[4], &stats, sizeof(stats));
return 4 + sizeof(stats); // reply_len
}
case REQ_TYPE_GET_TELEMETRY_DATA: {
telemetry.reset();
telemetry.addVoltage(TELEM_CHANNEL_SELF, (float)board.getBattMilliVolts() / 1000.0f);
// query other sensors -- target specific
sensors.querySensors(sender->is_admin ? 0xFF : 0x00, telemetry);
uint8_t tlen = telemetry.getSize();
memcpy(&reply_data[4], telemetry.getBuffer(), tlen);
return 4 + tlen; // reply_len
}
}
return 0; // unknown command
}
mesh::Packet* createSelfAdvert() {
uint8_t app_data[MAX_ADVERT_DATA_SIZE];
uint8_t app_data_len;
{
AdvertDataBuilder builder(ADV_TYPE_REPEATER, _prefs.node_name, _prefs.node_lat, _prefs.node_lon);
app_data_len = builder.encodeTo(app_data);
}
return createAdvert(self_id, app_data, app_data_len);
}
File openAppend(const char* fname) {
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
return _fs->open(fname, FILE_O_WRITE);
#elif defined(RP2040_PLATFORM)
return _fs->open(fname, "a");
#else
return _fs->open(fname, "a", true);
#endif
}
protected:
float getAirtimeBudgetFactor() const override {
return _prefs.airtime_factor;
}
bool allowPacketForward(const mesh::Packet* packet) override {
if (_prefs.disable_fwd) return false;
if (packet->isRouteFlood() && packet->path_len >= _prefs.flood_max) return false;
return true;
}
const char* getLogDateTime() override {
static char tmp[32];
uint32_t now = getRTCClock()->getCurrentTime();
DateTime dt = DateTime(now);
sprintf(tmp, "%02d:%02d:%02d - %d/%d/%d U", dt.hour(), dt.minute(), dt.second(), dt.day(), dt.month(), dt.year());
return tmp;
}
void logRxRaw(float snr, float rssi, const uint8_t raw[], int len) override {
#if MESH_PACKET_LOGGING
Serial.print(getLogDateTime());
Serial.print(" RAW: ");
mesh::Utils::printHex(Serial, raw, len);
Serial.println();
#endif
}
void logRx(mesh::Packet* pkt, int len, float score) override {
if (_logging) {
File f = openAppend(PACKET_LOG_FILE);
if (f) {
f.print(getLogDateTime());
f.printf(": RX, len=%d (type=%d, route=%s, payload_len=%d) SNR=%d RSSI=%d score=%d",
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len,
(int)_radio->getLastSNR(), (int)_radio->getLastRSSI(), (int)(score*1000));
if (pkt->getPayloadType() == PAYLOAD_TYPE_PATH || pkt->getPayloadType() == PAYLOAD_TYPE_REQ
|| pkt->getPayloadType() == PAYLOAD_TYPE_RESPONSE || pkt->getPayloadType() == PAYLOAD_TYPE_TXT_MSG) {
f.printf(" [%02X -> %02X]\n", (uint32_t)pkt->payload[1], (uint32_t)pkt->payload[0]);
} else {
f.printf("\n");
}
f.close();
}
}
}
void logTx(mesh::Packet* pkt, int len) override {
if (_logging) {
File f = openAppend(PACKET_LOG_FILE);
if (f) {
f.print(getLogDateTime());
f.printf(": TX, len=%d (type=%d, route=%s, payload_len=%d)",
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len);
if (pkt->getPayloadType() == PAYLOAD_TYPE_PATH || pkt->getPayloadType() == PAYLOAD_TYPE_REQ
|| pkt->getPayloadType() == PAYLOAD_TYPE_RESPONSE || pkt->getPayloadType() == PAYLOAD_TYPE_TXT_MSG) {
f.printf(" [%02X -> %02X]\n", (uint32_t)pkt->payload[1], (uint32_t)pkt->payload[0]);
} else {
f.printf("\n");
}
f.close();
}
}
}
void logTxFail(mesh::Packet* pkt, int len) override {
if (_logging) {
File f = openAppend(PACKET_LOG_FILE);
if (f) {
f.print(getLogDateTime());
f.printf(": TX FAIL!, len=%d (type=%d, route=%s, payload_len=%d)\n",
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len);
f.close();
}
}
}
int calcRxDelay(float score, uint32_t air_time) const override {
if (_prefs.rx_delay_base <= 0.0f) return 0;
return (int) ((pow(_prefs.rx_delay_base, 0.85f - score) - 1.0) * air_time);
}
uint32_t getRetransmitDelay(const mesh::Packet* packet) override {
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.tx_delay_factor);
return getRNG()->nextInt(0, 6)*t;
}
uint32_t getDirectRetransmitDelay(const mesh::Packet* packet) override {
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.direct_tx_delay_factor);
return getRNG()->nextInt(0, 6)*t;
}
void onAnonDataRecv(mesh::Packet* packet, uint8_t type, const mesh::Identity& sender, uint8_t* data, size_t len) override {
if (type == PAYLOAD_TYPE_ANON_REQ) { // received an initial request by a possible admin client (unknown at this stage)
uint32_t timestamp;
memcpy(&timestamp, data, 4);
bool is_admin;
data[len] = 0; // ensure null terminator
if (strcmp((char *) &data[4], _prefs.password) == 0) { // check for valid password
is_admin = true;
} else if (strcmp((char *) &data[4], _prefs.guest_password) == 0) { // check guest password
is_admin = false;
} else {
#if MESH_DEBUG
MESH_DEBUG_PRINTLN("Invalid password: %s", &data[4]);
#endif
return;
}
auto client = putClient(sender); // add to known clients (if not already known)
if (timestamp <= client->last_timestamp) {
MESH_DEBUG_PRINTLN("Possible login replay attack!");
return; // FATAL: client table is full -OR- replay attack
}
MESH_DEBUG_PRINTLN("Login success!");
client->last_timestamp = timestamp;
client->last_activity = getRTCClock()->getCurrentTime();
client->is_admin = is_admin;
uint32_t now = getRTCClock()->getCurrentTimeUnique();
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
#if 0
memcpy(&reply_data[4], "OK", 2); // legacy response
#else
reply_data[4] = RESP_SERVER_LOGIN_OK;
reply_data[5] = 0; // NEW: recommended keep-alive interval (secs / 16)
reply_data[6] = is_admin ? 1 : 0;
reply_data[7] = 0; // FUTURE: reserved
getRNG()->random(&reply_data[8], 4); // random blob to help packet-hash uniqueness
#endif
if (packet->isRouteFlood()) {
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
mesh::Packet* path = createPathReturn(sender, client->secret, packet->path, packet->path_len,
PAYLOAD_TYPE_RESPONSE, reply_data, 12);
if (path) sendFlood(path);
} else {
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, client->secret, reply_data, 12);
if (reply) {
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
sendDirect(reply, client->out_path, client->out_path_len);
} else {
sendFlood(reply);
}
}
}
}
}
int matching_peer_indexes[MAX_CLIENTS];
int searchPeersByHash(const uint8_t* hash) override {
int n = 0;
for (int i = 0; i < MAX_CLIENTS; i++) {
if (known_clients[i].id.isHashMatch(hash)) {
matching_peer_indexes[n++] = i; // store the INDEXES of matching contacts (for subsequent 'peer' methods)
}
}
return n;
}
void getPeerSharedSecret(uint8_t* dest_secret, int peer_idx) override {
int i = matching_peer_indexes[peer_idx];
if (i >= 0 && i < MAX_CLIENTS) {
// lookup pre-calculated shared_secret
memcpy(dest_secret, known_clients[i].secret, PUB_KEY_SIZE);
} else {
MESH_DEBUG_PRINTLN("getPeerSharedSecret: Invalid peer idx: %d", i);
}
}
void onAdvertRecv(mesh::Packet* packet, const mesh::Identity& id, uint32_t timestamp, const uint8_t* app_data, size_t app_data_len) {
mesh::Mesh::onAdvertRecv(packet, id, timestamp, app_data, app_data_len); // chain to super impl
// if this a zero hop advert, add it to neighbours
if (packet->path_len == 0) {
AdvertDataParser parser(app_data, app_data_len);
if (parser.isValid() && parser.getType() == ADV_TYPE_REPEATER) { // just keep neigbouring Repeaters
putNeighbour(id, timestamp, packet->getSNR());
}
}
}
void onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_idx, const uint8_t* secret, uint8_t* data, size_t len) override {
int i = matching_peer_indexes[sender_idx];
if (i < 0 || i >= MAX_CLIENTS) { // get from our known_clients table (sender SHOULD already be known in this context)
MESH_DEBUG_PRINTLN("onPeerDataRecv: invalid peer idx: %d", i);
return;
}
auto client = &known_clients[i];
if (type == PAYLOAD_TYPE_REQ) { // request (from a Known admin client!)
uint32_t timestamp;
memcpy(&timestamp, data, 4);
if (timestamp > client->last_timestamp) { // prevent replay attacks
int reply_len = handleRequest(client, timestamp, &data[4], len - 4);
if (reply_len == 0) return; // invalid command
client->last_timestamp = timestamp;
client->last_activity = getRTCClock()->getCurrentTime();
if (packet->isRouteFlood()) {
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
mesh::Packet* path = createPathReturn(client->id, secret, packet->path, packet->path_len,
PAYLOAD_TYPE_RESPONSE, reply_data, reply_len);
if (path) sendFlood(path);
} else {
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, client->id, secret, reply_data, reply_len);
if (reply) {
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
sendDirect(reply, client->out_path, client->out_path_len);
} else {
sendFlood(reply);
}
}
}
} else {
MESH_DEBUG_PRINTLN("onPeerDataRecv: possible replay attack detected");
}
} else if (type == PAYLOAD_TYPE_TXT_MSG && len > 5 && client->is_admin) { // a CLI command
uint32_t sender_timestamp;
memcpy(&sender_timestamp, data, 4); // timestamp (by sender's RTC clock - which could be wrong)
uint flags = (data[4] >> 2); // message attempt number, and other flags
if (!(flags == TXT_TYPE_PLAIN || flags == TXT_TYPE_CLI_DATA)) {
MESH_DEBUG_PRINTLN("onPeerDataRecv: unsupported text type received: flags=%02x", (uint32_t)flags);
} else if (sender_timestamp >= client->last_timestamp) { // prevent replay attacks
bool is_retry = (sender_timestamp == client->last_timestamp);
client->last_timestamp = sender_timestamp;
client->last_activity = getRTCClock()->getCurrentTime();
// len can be > original length, but 'text' will be padded with zeroes
data[len] = 0; // need to make a C string again, with null terminator
if (flags == TXT_TYPE_PLAIN) { // for legacy CLI, send Acks
uint32_t ack_hash; // calc truncated hash of the message timestamp + text + sender pub_key, to prove to sender that we got it
mesh::Utils::sha256((uint8_t *) &ack_hash, 4, data, 5 + strlen((char *)&data[5]), client->id.pub_key, PUB_KEY_SIZE);
mesh::Packet* ack = createAck(ack_hash);
if (ack) {
if (client->out_path_len < 0) {
sendFlood(ack);
} else {
sendDirect(ack, client->out_path, client->out_path_len);
}
}
}
uint8_t temp[166];
const char *command = (const char *) &data[5];
char *reply = (char *) &temp[5];
if (is_retry) {
*reply = 0;
} else {
_cli.handleCommand(sender_timestamp, command, reply);
}
int text_len = strlen(reply);
if (text_len > 0) {
uint32_t timestamp = getRTCClock()->getCurrentTimeUnique();
if (timestamp == sender_timestamp) {
// WORKAROUND: the two timestamps need to be different, in the CLI view
timestamp++;
}
memcpy(temp, &timestamp, 4); // mostly an extra blob to help make packet_hash unique
temp[4] = (TXT_TYPE_CLI_DATA << 2); // NOTE: legacy was: TXT_TYPE_PLAIN
auto reply = createDatagram(PAYLOAD_TYPE_TXT_MSG, client->id, secret, temp, 5 + text_len);
if (reply) {
if (client->out_path_len < 0) {
sendFlood(reply, CLI_REPLY_DELAY_MILLIS);
} else {
sendDirect(reply, client->out_path, client->out_path_len, CLI_REPLY_DELAY_MILLIS);
}
}
}
} else {
MESH_DEBUG_PRINTLN("onPeerDataRecv: possible replay attack detected");
}
}
}
bool onPeerPathRecv(mesh::Packet* packet, int sender_idx, const uint8_t* secret, uint8_t* path, uint8_t path_len, uint8_t extra_type, uint8_t* extra, uint8_t extra_len) override {
// TODO: prevent replay attacks
int i = matching_peer_indexes[sender_idx];
if (i >= 0 && i < MAX_CLIENTS) { // get from our known_clients table (sender SHOULD already be known in this context)
MESH_DEBUG_PRINTLN("PATH to client, path_len=%d", (uint32_t) path_len);
auto client = &known_clients[i];
memcpy(client->out_path, path, client->out_path_len = path_len); // store a copy of path, for sendDirect()
} else {
MESH_DEBUG_PRINTLN("onPeerPathRecv: invalid peer idx: %d", i);
}
// NOTE: no reciprocal path send!!
return false;
}
public:
MyMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables)
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32), tables),
_cli(board, rtc, &_prefs, this), telemetry(MAX_PACKET_PAYLOAD - 4)
{
memset(known_clients, 0, sizeof(known_clients));
next_local_advert = next_flood_advert = 0;
_logging = false;
#if MAX_NEIGHBOURS
memset(neighbours, 0, sizeof(neighbours));
#endif
// defaults
memset(&_prefs, 0, sizeof(_prefs));
_prefs.airtime_factor = 1.0; // one half
_prefs.rx_delay_base = 0.0f; // turn off by default, was 10.0;
_prefs.tx_delay_factor = 0.5f; // was 0.25f
StrHelper::strncpy(_prefs.node_name, ADVERT_NAME, sizeof(_prefs.node_name));
_prefs.node_lat = ADVERT_LAT;
_prefs.node_lon = ADVERT_LON;
StrHelper::strncpy(_prefs.password, ADMIN_PASSWORD, sizeof(_prefs.password));
_prefs.freq = LORA_FREQ;
_prefs.sf = LORA_SF;
_prefs.bw = LORA_BW;
_prefs.cr = LORA_CR;
_prefs.tx_power_dbm = LORA_TX_POWER;
_prefs.advert_interval = 1; // default to 2 minutes for NEW installs
_prefs.flood_advert_interval = 3; // 3 hours
_prefs.flood_max = 64;
}
CommonCLI* getCLI() { return &_cli; }
void begin(FILESYSTEM* fs) {
mesh::Mesh::begin();
_fs = fs;
// load persisted prefs
_cli.loadPrefs(_fs);
radio_set_params(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
radio_set_tx_power(_prefs.tx_power_dbm);
updateAdvertTimer();
updateFloodAdvertTimer();
}
const char* getFirmwareVer() override { return FIRMWARE_VERSION; }
const char* getBuildDate() override { return FIRMWARE_BUILD_DATE; }
const char* getRole() override { return FIRMWARE_ROLE; }
const char* getNodeName() { return _prefs.node_name; }
NodePrefs* getNodePrefs() {
return &_prefs;
}
void savePrefs() override {
_cli.savePrefs(_fs);
}
bool formatFileSystem() override {
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
return InternalFS.format();
#elif defined(RP2040_PLATFORM)
return LittleFS.format();
#elif defined(ESP32)
return SPIFFS.format();
#else
#error "need to implement file system erase"
return false;
#endif
}
void sendSelfAdvertisement(int delay_millis) override {
mesh::Packet* pkt = createSelfAdvert();
if (pkt) {
sendFlood(pkt, delay_millis);
} else {
MESH_DEBUG_PRINTLN("ERROR: unable to create advertisement packet!");
}
}
void updateAdvertTimer() override {
if (_prefs.advert_interval > 0) { // schedule local advert timer
next_local_advert = futureMillis( ((uint32_t)_prefs.advert_interval) * 2 * 60 * 1000);
} else {
next_local_advert = 0; // stop the timer
}
}
void updateFloodAdvertTimer() override {
if (_prefs.flood_advert_interval > 0) { // schedule flood advert timer
next_flood_advert = futureMillis( ((uint32_t)_prefs.flood_advert_interval) * 60 * 60 * 1000);
} else {
next_flood_advert = 0; // stop the timer
}
}
void setLoggingOn(bool enable) override { _logging = enable; }
void eraseLogFile() override {
_fs->remove(PACKET_LOG_FILE);
}
void dumpLogFile() override {
#if defined(RP2040_PLATFORM)
File f = _fs->open(PACKET_LOG_FILE, "r");
#else
File f = _fs->open(PACKET_LOG_FILE);
#endif
if (f) {
while (f.available()) {
int c = f.read();
if (c < 0) break;
Serial.print((char)c);
}
f.close();
}
}
void setTxPower(uint8_t power_dbm) override {
radio_set_tx_power(power_dbm);
}
void formatNeighborsReply(char *reply) override {
char *dp = reply;
#if MAX_NEIGHBOURS
for (int i = 0; i < MAX_NEIGHBOURS && dp - reply < 134; i++) {
NeighbourInfo* neighbour = &neighbours[i];
if (neighbour->heard_timestamp == 0) continue; // skip empty slots
// add new line if not first item
if (i > 0) *dp++ = '\n';
char hex[10];
// get 4 bytes of neighbour id as hex
mesh::Utils::toHex(hex, neighbour->id.pub_key, 4);
// add next neighbour
uint32_t secs_ago = getRTCClock()->getCurrentTime() - neighbour->heard_timestamp;
sprintf(dp, "%s:%d:%d", hex, secs_ago, neighbour->snr);
while (*dp) dp++; // find end of string
}
#endif
if (dp == reply) { // no neighbours, need empty response
strcpy(dp, "-none-"); dp += 6;
}
*dp = 0; // null terminator
}
const uint8_t* getSelfIdPubKey() override { return self_id.pub_key; }
void clearStats() override {
radio_driver.resetStats();
resetStats();
((SimpleMeshTables *)getTables())->resetStats();
}
void loop() {
mesh::Mesh::loop();
if (next_flood_advert && millisHasNowPassed(next_flood_advert)) {
mesh::Packet* pkt = createSelfAdvert();
if (pkt) sendFlood(pkt);
updateFloodAdvertTimer(); // schedule next flood advert
updateAdvertTimer(); // also schedule local advert (so they don't overlap)
} else if (next_local_advert && millisHasNowPassed(next_local_advert)) {
mesh::Packet* pkt = createSelfAdvert();
if (pkt) sendZeroHop(pkt);
updateAdvertTimer(); // schedule next local advert
}
#ifdef DISPLAY_CLASS
ui_task.loop();
#endif
}
};
StdRNG fast_rng;
SimpleMeshTables tables;
MyMesh the_mesh(board, radio_driver, *new ArduinoMillis(), fast_rng, rtc_clock, tables);
void halt() {
while (1) ;
}
static char command[80];
void setup() {
Serial.begin(115200);
delay(1000);
board.begin();
#ifdef DISPLAY_CLASS
if (display.begin()) {
display.startFrame();
display.print("Please wait...");
display.endFrame();
}
#endif
if (!radio_init()) { halt(); }
fast_rng.begin(radio_get_rng_seed());
FILESYSTEM* fs;
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
InternalFS.begin();
fs = &InternalFS;
IdentityStore store(InternalFS, "");
#elif defined(ESP32)
SPIFFS.begin(true);
fs = &SPIFFS;
IdentityStore store(SPIFFS, "/identity");
#elif defined(RP2040_PLATFORM)
LittleFS.begin();
fs = &LittleFS;
IdentityStore store(LittleFS, "/identity");
store.begin();
#else
#error "need to define filesystem"
#endif
if (!store.load("_main", the_mesh.self_id)) {
MESH_DEBUG_PRINTLN("Generating new keypair");
the_mesh.self_id = radio_new_identity(); // create new random identity
int count = 0;
while (count < 10 && (the_mesh.self_id.pub_key[0] == 0x00 || the_mesh.self_id.pub_key[0] == 0xFF)) { // reserved id hashes
the_mesh.self_id = radio_new_identity(); count++;
}
store.save("_main", the_mesh.self_id);
}
Serial.print("Repeater ID: ");
mesh::Utils::printHex(Serial, the_mesh.self_id.pub_key, PUB_KEY_SIZE); Serial.println();
command[0] = 0;
sensors.begin();
the_mesh.begin(fs);
#ifdef DISPLAY_CLASS
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
#endif
// send out initial Advertisement to the mesh
the_mesh.sendSelfAdvertisement(16000);
}
void loop() {
int len = strlen(command);
while (Serial.available() && len < sizeof(command)-1) {
char c = Serial.read();
if (c != '\n') {
command[len++] = c;
command[len] = 0;
}
Serial.print(c);
}
if (len == sizeof(command)-1) { // command buffer full
command[sizeof(command)-1] = '\r';
}
if (len > 0 && command[len - 1] == '\r') { // received complete line
command[len - 1] = 0; // replace newline with C string null terminator
char reply[160];
the_mesh.getCLI()->handleCommand(0, command, reply); // NOTE: there is no sender_timestamp via serial!
if (reply[0]) {
Serial.print(" -> "); Serial.println(reply);
}
command[0] = 0; // reset command buffer
}
the_mesh.loop();
sensors.loop();
}
+114
View File
@@ -0,0 +1,114 @@
#include "UITask.h"
#include <Arduino.h>
#include <helpers/CommonCLI.h>
#define AUTO_OFF_MILLIS 20000 // 20 seconds
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds
// 'meshcore', 128x13px
static const uint8_t meshcore_logo [] PROGMEM = {
0x3c, 0x01, 0xe3, 0xff, 0xc7, 0xff, 0x8f, 0x03, 0x87, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe,
0x3c, 0x03, 0xe3, 0xff, 0xc7, 0xff, 0x8e, 0x03, 0x8f, 0xfe, 0x3f, 0xfe, 0x1f, 0xff, 0x1f, 0xfe,
0x3e, 0x03, 0xc3, 0xff, 0x8f, 0xff, 0x0e, 0x07, 0x8f, 0xfe, 0x7f, 0xfe, 0x1f, 0xff, 0x1f, 0xfc,
0x3e, 0x07, 0xc7, 0x80, 0x0e, 0x00, 0x0e, 0x07, 0x9e, 0x00, 0x78, 0x0e, 0x3c, 0x0f, 0x1c, 0x00,
0x3e, 0x0f, 0xc7, 0x80, 0x1e, 0x00, 0x0e, 0x07, 0x1e, 0x00, 0x70, 0x0e, 0x38, 0x0f, 0x3c, 0x00,
0x7f, 0x0f, 0xc7, 0xfe, 0x1f, 0xfc, 0x1f, 0xff, 0x1c, 0x00, 0x70, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
0x7f, 0x1f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x0e, 0x38, 0x0e, 0x3f, 0xf8,
0x7f, 0x3f, 0xc7, 0xfe, 0x0f, 0xff, 0x1f, 0xff, 0x1c, 0x00, 0xf0, 0x1e, 0x3f, 0xfe, 0x3f, 0xf0,
0x77, 0x3b, 0x87, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xfc, 0x38, 0x00,
0x77, 0xfb, 0x8f, 0x00, 0x00, 0x07, 0x1c, 0x0f, 0x3c, 0x00, 0xe0, 0x1c, 0x7f, 0xf8, 0x38, 0x00,
0x73, 0xf3, 0x8f, 0xff, 0x0f, 0xff, 0x1c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x78, 0x7f, 0xf8,
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfe, 0x3c, 0x0e, 0x3f, 0xf8, 0xff, 0xfc, 0x70, 0x3c, 0x7f, 0xf8,
0xe3, 0xe3, 0x8f, 0xff, 0x1f, 0xfc, 0x3c, 0x0e, 0x1f, 0xf8, 0xff, 0xf8, 0x70, 0x3c, 0x7f, 0xf8,
};
void UITask::begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version) {
_prevBtnState = HIGH;
_auto_off = millis() + AUTO_OFF_MILLIS;
_node_prefs = node_prefs;
_display->turnOn();
// strip off dash and commit hash by changing dash to null terminator
// e.g: v1.2.3-abcdef -> v1.2.3
char *version = strdup(firmware_version);
char *dash = strchr(version, '-');
if(dash){
*dash = 0;
}
// v1.2.3 (1 Jan 2025)
sprintf(_version_info, "%s (%s)", version, build_date);
}
void UITask::renderCurrScreen() {
char tmp[80];
if (millis() < BOOT_SCREEN_MILLIS) { // boot screen
// meshcore logo
_display->setColor(DisplayDriver::BLUE);
int logoWidth = 128;
_display->drawXbm((_display->width() - logoWidth) / 2, 3, meshcore_logo, logoWidth, 13);
// version info
_display->setColor(DisplayDriver::LIGHT);
_display->setTextSize(1);
uint16_t versionWidth = _display->getTextWidth(_version_info);
_display->setCursor((_display->width() - versionWidth) / 2, 22);
_display->print(_version_info);
// node type
const char* node_type = "< Room Server >";
uint16_t typeWidth = _display->getTextWidth(node_type);
_display->setCursor((_display->width() - typeWidth) / 2, 35);
_display->print(node_type);
} else { // home screen
// node name
_display->setCursor(0, 0);
_display->setTextSize(1);
_display->setColor(DisplayDriver::GREEN);
_display->print(_node_prefs->node_name);
// freq / sf
_display->setCursor(0, 20);
_display->setColor(DisplayDriver::YELLOW);
sprintf(tmp, "FREQ: %06.3f SF%d", _node_prefs->freq, _node_prefs->sf);
_display->print(tmp);
// bw / cr
_display->setCursor(0, 30);
sprintf(tmp, "BW: %03.2f CR: %d", _node_prefs->bw, _node_prefs->cr);
_display->print(tmp);
}
}
void UITask::loop() {
#ifdef PIN_USER_BTN
if (millis() >= _next_read) {
int btnState = digitalRead(PIN_USER_BTN);
if (btnState != _prevBtnState) {
if (btnState == LOW) { // pressed?
if (_display->isOn()) {
// TODO: any action ?
} else {
_display->turnOn();
}
_auto_off = millis() + AUTO_OFF_MILLIS; // extend auto-off timer
}
_prevBtnState = btnState;
}
_next_read = millis() + 200; // 5 reads per second
}
#endif
if (_display->isOn()) {
if (millis() >= _next_refresh) {
_display->startFrame();
renderCurrScreen();
_display->endFrame();
_next_refresh = millis() + 1000; // refresh every second
}
if (millis() > _auto_off) {
_display->turnOff();
}
}
}
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include <helpers/ui/DisplayDriver.h>
#include <helpers/CommonCLI.h>
class UITask {
DisplayDriver* _display;
unsigned long _next_read, _next_refresh, _auto_off;
int _prevBtnState;
NodePrefs* _node_prefs;
char _version_info[32];
void renderCurrScreen();
public:
UITask(DisplayDriver& display) : _display(&display) { _next_read = _next_refresh = 0; }
void begin(NodePrefs* node_prefs, const char* build_date, const char* firmware_version);
void loop();
};
+989
View File
@@ -0,0 +1,989 @@
#include <Arduino.h> // needed for PlatformIO
#include <Mesh.h>
#if defined(NRF52_PLATFORM)
#include <InternalFileSystem.h>
#elif defined(RP2040_PLATFORM)
#include <LittleFS.h>
#elif defined(ESP32)
#include <SPIFFS.h>
#endif
#include <helpers/ArduinoHelpers.h>
#include <helpers/StaticPoolPacketManager.h>
#include <helpers/SimpleMeshTables.h>
#include <helpers/IdentityStore.h>
#include <helpers/AdvertDataHelpers.h>
#include <helpers/TxtDataHelpers.h>
#include <helpers/CommonCLI.h>
#include <RTClib.h>
#include <target.h>
/* ------------------------------ Config -------------------------------- */
#ifndef FIRMWARE_BUILD_DATE
#define FIRMWARE_BUILD_DATE "24 May 2025"
#endif
#ifndef FIRMWARE_VERSION
#define FIRMWARE_VERSION "v1.6.2"
#endif
#ifndef LORA_FREQ
#define LORA_FREQ 915.0
#endif
#ifndef LORA_BW
#define LORA_BW 250
#endif
#ifndef LORA_SF
#define LORA_SF 10
#endif
#ifndef LORA_CR
#define LORA_CR 5
#endif
#ifndef LORA_TX_POWER
#define LORA_TX_POWER 20
#endif
#ifndef ADVERT_NAME
#define ADVERT_NAME "Test BBS"
#endif
#ifndef ADVERT_LAT
#define ADVERT_LAT 0.0
#endif
#ifndef ADVERT_LON
#define ADVERT_LON 0.0
#endif
#ifndef ADMIN_PASSWORD
#define ADMIN_PASSWORD "password"
#endif
#ifndef MAX_CLIENTS
#define MAX_CLIENTS 32
#endif
#ifndef MAX_UNSYNCED_POSTS
#define MAX_UNSYNCED_POSTS 32
#endif
#ifdef DISPLAY_CLASS
#include "UITask.h"
static UITask ui_task(display);
#endif
#define FIRMWARE_ROLE "room_server"
#define PACKET_LOG_FILE "/packet_log"
/* ------------------------------ Code -------------------------------- */
enum RoomPermission {
ADMIN,
GUEST,
READ_ONLY
};
struct ClientInfo {
mesh::Identity id;
uint32_t last_timestamp; // by THEIR clock
uint32_t last_activity; // by OUR clock
uint32_t sync_since; // sync messages SINCE this timestamp (by OUR clock)
uint32_t pending_ack;
uint32_t push_post_timestamp;
unsigned long ack_timeout;
RoomPermission permission;
uint8_t push_failures;
uint8_t secret[PUB_KEY_SIZE];
int out_path_len;
uint8_t out_path[MAX_PATH_SIZE];
};
#define MAX_POST_TEXT_LEN (160-9)
struct PostInfo {
mesh::Identity author;
uint32_t post_timestamp; // by OUR clock
char text[MAX_POST_TEXT_LEN+1];
};
#define REPLY_DELAY_MILLIS 1500
#define PUSH_NOTIFY_DELAY_MILLIS 2000
#define SYNC_PUSH_INTERVAL 1200
#define PUSH_ACK_TIMEOUT_FLOOD 12000
#define PUSH_TIMEOUT_BASE 4000
#define PUSH_ACK_TIMEOUT_FACTOR 2000
#define CLIENT_KEEP_ALIVE_SECS 128
#define REQ_TYPE_GET_STATUS 0x01 // same as _GET_STATS
#define REQ_TYPE_KEEP_ALIVE 0x02
#define REQ_TYPE_GET_TELEMETRY_DATA 0x03
#define RESP_SERVER_LOGIN_OK 0 // response to ANON_REQ
struct ServerStats {
uint16_t batt_milli_volts;
uint16_t curr_tx_queue_len;
uint16_t curr_free_queue_len;
int16_t last_rssi;
uint32_t n_packets_recv;
uint32_t n_packets_sent;
uint32_t total_air_time_secs;
uint32_t total_up_time_secs;
uint32_t n_sent_flood, n_sent_direct;
uint32_t n_recv_flood, n_recv_direct;
uint16_t err_events; // was 'n_full_events'
int16_t last_snr; // x 4
uint16_t n_direct_dups, n_flood_dups;
uint16_t n_posted, n_post_push;
};
class MyMesh : public mesh::Mesh, public CommonCLICallbacks {
FILESYSTEM* _fs;
unsigned long next_local_advert, next_flood_advert;
bool _logging;
NodePrefs _prefs;
CommonCLI _cli;
uint8_t reply_data[MAX_PACKET_PAYLOAD];
int num_clients;
ClientInfo known_clients[MAX_CLIENTS];
unsigned long next_push;
uint16_t _num_posted, _num_post_pushes;
int next_client_idx; // for round-robin polling
int next_post_idx;
PostInfo posts[MAX_UNSYNCED_POSTS]; // cyclic queue
CayenneLPP telemetry;
ClientInfo* putClient(const mesh::Identity& id) {
for (int i = 0; i < num_clients; i++) {
if (id.matches(known_clients[i].id)) return &known_clients[i]; // already known
}
ClientInfo* newClient;
if (num_clients < MAX_CLIENTS) {
newClient = &known_clients[num_clients++];
} else { // table is currently full
// evict least active client
uint32_t oldest_timestamp = 0xFFFFFFFF;
newClient = &known_clients[0];
for (int i = 0; i < num_clients; i++) {
auto c = &known_clients[i];
if (c->last_activity < oldest_timestamp) {
oldest_timestamp = c->last_activity;
newClient = c;
}
}
}
newClient->id = id;
newClient->out_path_len = -1; // initially out_path is unknown
newClient->last_timestamp = 0;
self_id.calcSharedSecret(newClient->secret, id); // calc ECDH shared secret
return newClient;
}
void evict(ClientInfo* client) {
client->last_activity = 0; // this slot will now be re-used (will be oldest)
memset(client->id.pub_key, 0, sizeof(client->id.pub_key));
memset(client->secret, 0, sizeof(client->secret));
client->pending_ack = 0;
}
void addPost(ClientInfo* client, const char* postData) {
// TODO: suggested postData format: <title>/<descrption>
posts[next_post_idx].author = client->id; // add to cyclic queue
StrHelper::strncpy(posts[next_post_idx].text, postData, MAX_POST_TEXT_LEN);
posts[next_post_idx].post_timestamp = getRTCClock()->getCurrentTimeUnique();
next_post_idx = (next_post_idx + 1) % MAX_UNSYNCED_POSTS;
next_push = futureMillis(PUSH_NOTIFY_DELAY_MILLIS);
_num_posted++; // stats
}
void pushPostToClient(ClientInfo* client, PostInfo& post) {
int len = 0;
memcpy(&reply_data[len], &post.post_timestamp, 4); len += 4; // this is a PAST timestamp... but should be accepted by client
reply_data[len++] = (TXT_TYPE_SIGNED_PLAIN << 2); // 'signed' plain text
// encode prefix of post.author.pub_key
memcpy(&reply_data[len], post.author.pub_key, 4); len += 4; // just first 4 bytes
int text_len = strlen(post.text);
memcpy(&reply_data[len], post.text, text_len); len += text_len;
// calc expected ACK reply
mesh::Utils::sha256((uint8_t *)&client->pending_ack, 4, reply_data, len, client->id.pub_key, PUB_KEY_SIZE);
client->push_post_timestamp = post.post_timestamp;
auto reply = createDatagram(PAYLOAD_TYPE_TXT_MSG, client->id, client->secret, reply_data, len);
if (reply) {
if (client->out_path_len < 0) {
sendFlood(reply);
client->ack_timeout = futureMillis(PUSH_ACK_TIMEOUT_FLOOD);
} else {
sendDirect(reply, client->out_path, client->out_path_len);
client->ack_timeout = futureMillis(PUSH_TIMEOUT_BASE + PUSH_ACK_TIMEOUT_FACTOR * (client->out_path_len + 1));
}
_num_post_pushes++; // stats
} else {
client->pending_ack = 0;
MESH_DEBUG_PRINTLN("Unable to push post to client");
}
}
uint8_t getUnsyncedCount(ClientInfo* client) {
uint8_t count = 0;
for (int k = 0; k < MAX_UNSYNCED_POSTS; k++) {
if (posts[k].post_timestamp > client->sync_since // is new post for this Client?
&& !posts[k].author.matches(client->id)) { // don't push posts to the author
count++;
}
}
return count;
}
bool processAck(const uint8_t *data) {
for (int i = 0; i < num_clients; i++) {
auto client = &known_clients[i];
if (client->pending_ack && memcmp(data, &client->pending_ack, 4) == 0) { // got an ACK from Client!
client->pending_ack = 0; // clear this, so next push can happen
client->push_failures = 0;
client->sync_since = client->push_post_timestamp; // advance Client's SINCE timestamp, to sync next post
return true;
}
}
return false;
}
mesh::Packet* createSelfAdvert() {
uint8_t app_data[MAX_ADVERT_DATA_SIZE];
uint8_t app_data_len;
{
AdvertDataBuilder builder(ADV_TYPE_ROOM, _prefs.node_name, _prefs.node_lat, _prefs.node_lon);
app_data_len = builder.encodeTo(app_data);
}
return createAdvert(self_id, app_data, app_data_len);
}
File openAppend(const char* fname) {
#if defined(NRF52_PLATFORM)
return _fs->open(fname, FILE_O_WRITE);
#elif defined(RP2040_PLATFORM)
return _fs->open(fname, "a");
#else
return _fs->open(fname, "a", true);
#endif
}
int handleRequest(ClientInfo* sender, uint32_t sender_timestamp, uint8_t* payload, size_t payload_len) {
// uint32_t now = getRTCClock()->getCurrentTimeUnique();
// memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
memcpy(reply_data, &sender_timestamp, 4); // reflect sender_timestamp back in response packet (kind of like a 'tag')
switch (payload[0]) {
case REQ_TYPE_GET_STATUS: {
ServerStats stats;
stats.batt_milli_volts = board.getBattMilliVolts();
stats.curr_tx_queue_len = _mgr->getOutboundCount(0xFFFFFFFF);
stats.curr_free_queue_len = _mgr->getFreeCount();
stats.last_rssi = (int16_t) radio_driver.getLastRSSI();
stats.n_packets_recv = radio_driver.getPacketsRecv();
stats.n_packets_sent = radio_driver.getPacketsSent();
stats.total_air_time_secs = getTotalAirTime() / 1000;
stats.total_up_time_secs = _ms->getMillis() / 1000;
stats.n_sent_flood = getNumSentFlood();
stats.n_sent_direct = getNumSentDirect();
stats.n_recv_flood = getNumRecvFlood();
stats.n_recv_direct = getNumRecvDirect();
stats.err_events = _err_flags;
stats.last_snr = (int16_t)(radio_driver.getLastSNR() * 4);
stats.n_direct_dups = ((SimpleMeshTables *)getTables())->getNumDirectDups();
stats.n_flood_dups = ((SimpleMeshTables *)getTables())->getNumFloodDups();
stats.n_posted = _num_posted;
stats.n_post_push = _num_post_pushes;
memcpy(&reply_data[4], &stats, sizeof(stats));
return 4 + sizeof(stats);
}
case REQ_TYPE_GET_TELEMETRY_DATA: {
telemetry.reset();
telemetry.addVoltage(TELEM_CHANNEL_SELF, (float)board.getBattMilliVolts() / 1000.0f);
// query other sensors -- target specific
sensors.querySensors(sender->permission == RoomPermission::ADMIN ? 0xFF : 0x00, telemetry);
uint8_t tlen = telemetry.getSize();
memcpy(&reply_data[4], telemetry.getBuffer(), tlen);
return 4 + tlen; // reply_len
}
}
return 0; // unknown command
}
protected:
float getAirtimeBudgetFactor() const override {
return _prefs.airtime_factor;
}
void logRxRaw(float snr, float rssi, const uint8_t raw[], int len) override {
#if MESH_PACKET_LOGGING
Serial.print(getLogDateTime());
Serial.print(" RAW: ");
mesh::Utils::printHex(Serial, raw, len);
Serial.println();
#endif
}
void logRx(mesh::Packet* pkt, int len, float score) override {
if (_logging) {
File f = openAppend(PACKET_LOG_FILE);
if (f) {
f.print(getLogDateTime());
f.printf(": RX, len=%d (type=%d, route=%s, payload_len=%d) SNR=%d RSSI=%d score=%d",
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len,
(int)_radio->getLastSNR(), (int)_radio->getLastRSSI(), (int)(score*1000));
if (pkt->getPayloadType() == PAYLOAD_TYPE_PATH || pkt->getPayloadType() == PAYLOAD_TYPE_REQ
|| pkt->getPayloadType() == PAYLOAD_TYPE_RESPONSE || pkt->getPayloadType() == PAYLOAD_TYPE_TXT_MSG) {
f.printf(" [%02X -> %02X]\n", (uint32_t)pkt->payload[1], (uint32_t)pkt->payload[0]);
} else {
f.printf("\n");
}
f.close();
}
}
}
void logTx(mesh::Packet* pkt, int len) override {
if (_logging) {
File f = openAppend(PACKET_LOG_FILE);
if (f) {
f.print(getLogDateTime());
f.printf(": TX, len=%d (type=%d, route=%s, payload_len=%d)",
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len);
if (pkt->getPayloadType() == PAYLOAD_TYPE_PATH || pkt->getPayloadType() == PAYLOAD_TYPE_REQ
|| pkt->getPayloadType() == PAYLOAD_TYPE_RESPONSE || pkt->getPayloadType() == PAYLOAD_TYPE_TXT_MSG) {
f.printf(" [%02X -> %02X]\n", (uint32_t)pkt->payload[1], (uint32_t)pkt->payload[0]);
} else {
f.printf("\n");
}
f.close();
}
}
}
void logTxFail(mesh::Packet* pkt, int len) override {
if (_logging) {
File f = openAppend(PACKET_LOG_FILE);
if (f) {
f.print(getLogDateTime());
f.printf(": TX FAIL!, len=%d (type=%d, route=%s, payload_len=%d)\n",
len, pkt->getPayloadType(), pkt->isRouteDirect() ? "D" : "F", pkt->payload_len);
f.close();
}
}
}
int calcRxDelay(float score, uint32_t air_time) const override {
if (_prefs.rx_delay_base <= 0.0f) return 0;
return (int) ((pow(_prefs.rx_delay_base, 0.85f - score) - 1.0) * air_time);
}
const char* getLogDateTime() override {
static char tmp[32];
uint32_t now = getRTCClock()->getCurrentTime();
DateTime dt = DateTime(now);
sprintf(tmp, "%02d:%02d:%02d - %d/%d/%d U", dt.hour(), dt.minute(), dt.second(), dt.day(), dt.month(), dt.year());
return tmp;
}
uint32_t getRetransmitDelay(const mesh::Packet* packet) override {
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.tx_delay_factor);
return getRNG()->nextInt(0, 6)*t;
}
uint32_t getDirectRetransmitDelay(const mesh::Packet* packet) override {
uint32_t t = (_radio->getEstAirtimeFor(packet->path_len + packet->payload_len + 2) * _prefs.direct_tx_delay_factor);
return getRNG()->nextInt(0, 6)*t;
}
bool allowPacketForward(const mesh::Packet* packet) override {
if (_prefs.disable_fwd) return false;
if (packet->isRouteFlood() && packet->path_len >= _prefs.flood_max) return false;
return true;
}
void onAnonDataRecv(mesh::Packet* packet, uint8_t type, const mesh::Identity& sender, uint8_t* data, size_t len) override {
if (type == PAYLOAD_TYPE_ANON_REQ) { // received an initial request by a possible admin client (unknown at this stage)
uint32_t sender_timestamp, sender_sync_since;
memcpy(&sender_timestamp, data, 4);
memcpy(&sender_sync_since, &data[4], 4); // sender's "sync messags SINCE x" timestamp
RoomPermission perm;
data[len] = 0; // ensure null terminator
if (strcmp((char *) &data[8], _prefs.password) == 0) { // check for valid admin password
perm = RoomPermission::ADMIN;
} else {
if (strcmp((char *) &data[8], _prefs.guest_password) == 0) { // check the room/public password
perm = RoomPermission::GUEST;
} else if (_prefs.allow_read_only) {
perm = RoomPermission::READ_ONLY;
} else {
MESH_DEBUG_PRINTLN("Incorrect room password");
return; // no response. Client will timeout
}
}
auto client = putClient(sender); // add to known clients (if not already known)
if (sender_timestamp <= client->last_timestamp) {
MESH_DEBUG_PRINTLN("possible replay attack!");
return;
}
MESH_DEBUG_PRINTLN("Login success!");
client->permission = perm;
client->last_timestamp = sender_timestamp;
client->sync_since = sender_sync_since;
client->pending_ack = 0;
client->push_failures = 0;
uint32_t now = getRTCClock()->getCurrentTime();
client->last_activity = now;
now = getRTCClock()->getCurrentTimeUnique();
memcpy(reply_data, &now, 4); // response packets always prefixed with timestamp
// TODO: maybe reply with count of messages waiting to be synced for THIS client?
reply_data[4] = RESP_SERVER_LOGIN_OK;
reply_data[5] = (CLIENT_KEEP_ALIVE_SECS >> 4); // NEW: recommended keep-alive interval (secs / 16)
reply_data[6] = (perm == RoomPermission::ADMIN ? 1 : (perm == RoomPermission::GUEST ? 0 : 2));
reply_data[7] = getUnsyncedCount(client); // NEW
memcpy(&reply_data[8], "OK", 2); // REVISIT: not really needed
next_push = futureMillis(PUSH_NOTIFY_DELAY_MILLIS); // delay next push, give RESPONSE packet time to arrive first
if (packet->isRouteFlood()) {
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
mesh::Packet* path = createPathReturn(sender, client->secret, packet->path, packet->path_len,
PAYLOAD_TYPE_RESPONSE, reply_data, 8 + 2);
if (path) sendFlood(path);
} else {
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, sender, client->secret, reply_data, 8 + 2);
if (reply) {
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
sendDirect(reply, client->out_path, client->out_path_len);
} else {
sendFlood(reply);
}
}
}
}
}
int matching_peer_indexes[MAX_CLIENTS];
int searchPeersByHash(const uint8_t* hash) override {
int n = 0;
for (int i = 0; i < num_clients; i++) {
if (known_clients[i].id.isHashMatch(hash)) {
matching_peer_indexes[n++] = i; // store the INDEXES of matching contacts (for subsequent 'peer' methods)
}
}
return n;
}
void getPeerSharedSecret(uint8_t* dest_secret, int peer_idx) override {
int i = matching_peer_indexes[peer_idx];
if (i >= 0 && i < num_clients) {
// lookup pre-calculated shared_secret
memcpy(dest_secret, known_clients[i].secret, PUB_KEY_SIZE);
} else {
MESH_DEBUG_PRINTLN("getPeerSharedSecret: Invalid peer idx: %d", i);
}
}
void onPeerDataRecv(mesh::Packet* packet, uint8_t type, int sender_idx, const uint8_t* secret, uint8_t* data, size_t len) override {
int i = matching_peer_indexes[sender_idx];
if (i < 0 || i >= num_clients) { // get from our known_clients table (sender SHOULD already be known in this context)
MESH_DEBUG_PRINTLN("onPeerDataRecv: invalid peer idx: %d", i);
return;
}
auto client = &known_clients[i];
if (type == PAYLOAD_TYPE_TXT_MSG && len > 5) { // a CLI command or new Post
uint32_t sender_timestamp;
memcpy(&sender_timestamp, data, 4); // timestamp (by sender's RTC clock - which could be wrong)
uint flags = (data[4] >> 2); // message attempt number, and other flags
if (!(flags == TXT_TYPE_PLAIN || flags == TXT_TYPE_CLI_DATA)) {
MESH_DEBUG_PRINTLN("onPeerDataRecv: unsupported command flags received: flags=%02x", (uint32_t)flags);
} else if (sender_timestamp >= client->last_timestamp) { // prevent replay attacks, but send Acks for retries
bool is_retry = (sender_timestamp == client->last_timestamp);
client->last_timestamp = sender_timestamp;
uint32_t now = getRTCClock()->getCurrentTimeUnique();
client->last_activity = now;
client->push_failures = 0; // reset so push can resume (if prev failed)
// len can be > original length, but 'text' will be padded with zeroes
data[len] = 0; // need to make a C string again, with null terminator
uint32_t ack_hash; // calc truncated hash of the message timestamp + text + sender pub_key, to prove to sender that we got it
mesh::Utils::sha256((uint8_t *) &ack_hash, 4, data, 5 + strlen((char *)&data[5]), client->id.pub_key, PUB_KEY_SIZE);
uint8_t temp[166];
bool send_ack;
if (flags == TXT_TYPE_CLI_DATA) {
if (client->permission == RoomPermission::ADMIN) {
if (is_retry) {
temp[5] = 0; // no reply
} else {
_cli.handleCommand(sender_timestamp, (const char *) &data[5], (char *) &temp[5]);
temp[4] = (TXT_TYPE_CLI_DATA << 2); // attempt and flags, (NOTE: legacy was: TXT_TYPE_PLAIN)
}
send_ack = false;
} else {
temp[5] = 0; // no reply
send_ack = false; // and no ACK... user shoudn't be sending these
}
} else { // TXT_TYPE_PLAIN
if (client->permission == RoomPermission::READ_ONLY) {
temp[5] = 0; // no reply
send_ack = false; // no ACK
} else {
if (!is_retry) {
addPost(client, (const char *) &data[5]);
}
temp[5] = 0; // no reply (ACK is enough)
send_ack = true;
}
}
uint32_t delay_millis;
if (send_ack) {
mesh::Packet* ack = createAck(ack_hash);
if (ack) {
if (client->out_path_len < 0) {
sendFlood(ack);
} else {
sendDirect(ack, client->out_path, client->out_path_len);
}
}
delay_millis = REPLY_DELAY_MILLIS;
} else {
delay_millis = 0;
}
int text_len = strlen((char *) &temp[5]);
if (text_len > 0) {
if (now == sender_timestamp) {
// WORKAROUND: the two timestamps need to be different, in the CLI view
now++;
}
memcpy(temp, &now, 4); // mostly an extra blob to help make packet_hash unique
// calc expected ACK reply
//mesh::Utils::sha256((uint8_t *)&expected_ack_crc, 4, temp, 5 + text_len, self_id.pub_key, PUB_KEY_SIZE);
auto reply = createDatagram(PAYLOAD_TYPE_TXT_MSG, client->id, secret, temp, 5 + text_len);
if (reply) {
if (client->out_path_len < 0) {
sendFlood(reply, delay_millis);
} else {
sendDirect(reply, client->out_path, client->out_path_len, delay_millis);
}
}
}
} else {
MESH_DEBUG_PRINTLN("onPeerDataRecv: possible replay attack detected");
}
} else if (type == PAYLOAD_TYPE_REQ && len >= 5) {
uint32_t sender_timestamp;
memcpy(&sender_timestamp, data, 4); // timestamp (by sender's RTC clock - which could be wrong)
if (sender_timestamp < client->last_timestamp) { // prevent replay attacks
MESH_DEBUG_PRINTLN("onPeerDataRecv: possible replay attack detected");
} else {
client->last_timestamp = sender_timestamp;
uint32_t now = getRTCClock()->getCurrentTime();
client->last_activity = now; // <-- THIS will keep client connection alive
client->push_failures = 0; // reset so push can resume (if prev failed)
if (data[4] == REQ_TYPE_KEEP_ALIVE && packet->isRouteDirect()) { // request type
uint32_t forceSince = 0;
if (len >= 9) { // optional - last post_timestamp client received
memcpy(&forceSince, &data[5], 4); // NOTE: this may be 0, if part of decrypted PADDING!
} else {
memcpy(&data[5], &forceSince, 4); // make sure there are zeroes in payload (for ack_hash calc below)
}
if (forceSince > 0) {
client->sync_since = forceSince; // force-update the 'sync since'
}
client->pending_ack = 0;
// TODO: Throttle KEEP_ALIVE requests!
// if client sends too quickly, evict()
// RULE: only send keep_alive response DIRECT!
if (client->out_path_len >= 0) {
uint32_t ack_hash; // calc ACK to prove to sender that we got request
mesh::Utils::sha256((uint8_t *) &ack_hash, 4, data, 9, client->id.pub_key, PUB_KEY_SIZE);
auto reply = createAck(ack_hash);
if (reply) {
reply->payload[reply->payload_len++] = getUnsyncedCount(client); // NEW: add unsynced counter to end of ACK packet
sendDirect(reply, client->out_path, client->out_path_len);
}
}
} else {
int reply_len = handleRequest(client, sender_timestamp, &data[4], len - 4);
if (reply_len > 0) { // valid command
if (packet->isRouteFlood()) {
// let this sender know path TO here, so they can use sendDirect(), and ALSO encode the response
mesh::Packet* path = createPathReturn(client->id, secret, packet->path, packet->path_len,
PAYLOAD_TYPE_RESPONSE, reply_data, reply_len);
if (path) sendFlood(path);
} else {
mesh::Packet* reply = createDatagram(PAYLOAD_TYPE_RESPONSE, client->id, secret, reply_data, reply_len);
if (reply) {
if (client->out_path_len >= 0) { // we have an out_path, so send DIRECT
sendDirect(reply, client->out_path, client->out_path_len);
} else {
sendFlood(reply);
}
}
}
}
}
}
}
}
bool onPeerPathRecv(mesh::Packet* packet, int sender_idx, const uint8_t* secret, uint8_t* path, uint8_t path_len, uint8_t extra_type, uint8_t* extra, uint8_t extra_len) override {
// TODO: prevent replay attacks
int i = matching_peer_indexes[sender_idx];
if (i >= 0 && i < num_clients) { // get from our known_clients table (sender SHOULD already be known in this context)
MESH_DEBUG_PRINTLN("PATH to client, path_len=%d", (uint32_t) path_len);
auto client = &known_clients[i];
memcpy(client->out_path, path, client->out_path_len = path_len); // store a copy of path, for sendDirect()
} else {
MESH_DEBUG_PRINTLN("onPeerPathRecv: invalid peer idx: %d", i);
}
if (extra_type == PAYLOAD_TYPE_ACK && extra_len >= 4) {
// also got an encoded ACK!
processAck(extra);
}
// NOTE: no reciprocal path send!!
return false;
}
void onAckRecv(mesh::Packet* packet, uint32_t ack_crc) override {
if (processAck((uint8_t *)&ack_crc)) {
packet->markDoNotRetransmit(); // ACK was for this node, so don't retransmit
}
}
public:
MyMesh(mesh::MainBoard& board, mesh::Radio& radio, mesh::MillisecondClock& ms, mesh::RNG& rng, mesh::RTCClock& rtc, mesh::MeshTables& tables)
: mesh::Mesh(radio, ms, rng, rtc, *new StaticPoolPacketManager(32), tables),
_cli(board, rtc, &_prefs, this), telemetry(MAX_PACKET_PAYLOAD - 4)
{
next_local_advert = next_flood_advert = 0;
_logging = false;
// defaults
memset(&_prefs, 0, sizeof(_prefs));
_prefs.airtime_factor = 1.0; // one half
_prefs.rx_delay_base = 0.0f; // off by default, was 10.0
_prefs.tx_delay_factor = 0.5f; // was 0.25f;
StrHelper::strncpy(_prefs.node_name, ADVERT_NAME, sizeof(_prefs.node_name));
_prefs.node_lat = ADVERT_LAT;
_prefs.node_lon = ADVERT_LON;
StrHelper::strncpy(_prefs.password, ADMIN_PASSWORD, sizeof(_prefs.password));
_prefs.freq = LORA_FREQ;
_prefs.sf = LORA_SF;
_prefs.bw = LORA_BW;
_prefs.cr = LORA_CR;
_prefs.tx_power_dbm = LORA_TX_POWER;
_prefs.disable_fwd = 1;
_prefs.advert_interval = 1; // default to 2 minutes for NEW installs
_prefs.flood_advert_interval = 3; // 3 hours
_prefs.flood_max = 64;
#ifdef ROOM_PASSWORD
StrHelper::strncpy(_prefs.guest_password, ROOM_PASSWORD, sizeof(_prefs.guest_password));
#endif
num_clients = 0;
next_post_idx = 0;
next_client_idx = 0;
next_push = 0;
memset(posts, 0, sizeof(posts));
_num_posted = _num_post_pushes = 0;
}
CommonCLI* getCLI() { return &_cli; }
void begin(FILESYSTEM* fs) {
mesh::Mesh::begin();
_fs = fs;
// load persisted prefs
_cli.loadPrefs(_fs);
radio_set_params(_prefs.freq, _prefs.bw, _prefs.sf, _prefs.cr);
radio_set_tx_power(_prefs.tx_power_dbm);
updateAdvertTimer();
updateFloodAdvertTimer();
}
const char* getFirmwareVer() override { return FIRMWARE_VERSION; }
const char* getBuildDate() override { return FIRMWARE_BUILD_DATE; }
const char* getRole() override { return FIRMWARE_ROLE; }
const char* getNodeName() { return _prefs.node_name; }
NodePrefs* getNodePrefs() {
return &_prefs;
}
void savePrefs() override {
_cli.savePrefs(_fs);
}
bool formatFileSystem() override {
#if defined(NRF52_PLATFORM)
return InternalFS.format();
#elif defined(RP2040_PLATFORM)
return LittleFS.format();
#elif defined(ESP32)
return SPIFFS.format();
#else
#error "need to implement file system erase"
return false;
#endif
}
void sendSelfAdvertisement(int delay_millis) override {
mesh::Packet* pkt = createSelfAdvert();
if (pkt) {
sendFlood(pkt, delay_millis);
} else {
MESH_DEBUG_PRINTLN("ERROR: unable to create advertisement packet!");
}
}
void updateAdvertTimer() override {
if (_prefs.advert_interval > 0) { // schedule local advert timer
next_local_advert = futureMillis((uint32_t)_prefs.advert_interval * 2 * 60 * 1000);
} else {
next_local_advert = 0; // stop the timer
}
}
void updateFloodAdvertTimer() override {
if (_prefs.flood_advert_interval > 0) { // schedule flood advert timer
next_flood_advert = futureMillis( ((uint32_t)_prefs.flood_advert_interval) * 60 * 60 * 1000);
} else {
next_flood_advert = 0; // stop the timer
}
}
void setLoggingOn(bool enable) override { _logging = enable; }
void eraseLogFile() override {
_fs->remove(PACKET_LOG_FILE);
}
void dumpLogFile() override {
#if defined(RP2040_PLATFORM)
File f = _fs->open(PACKET_LOG_FILE, "r");
#else
File f = _fs->open(PACKET_LOG_FILE);
#endif
if (f) {
while (f.available()) {
int c = f.read();
if (c < 0) break;
Serial.print((char)c);
}
f.close();
}
}
void setTxPower(uint8_t power_dbm) override {
radio_set_tx_power(power_dbm);
}
void formatNeighborsReply(char *reply) override {
strcpy(reply, "not supported");
}
const uint8_t* getSelfIdPubKey() override { return self_id.pub_key; }
void clearStats() override {
radio_driver.resetStats();
resetStats();
((SimpleMeshTables *)getTables())->resetStats();
}
void loop() {
mesh::Mesh::loop();
if (millisHasNowPassed(next_push) && num_clients > 0) {
// check for ACK timeouts
for (int i = 0; i < num_clients; i++) {
auto c = &known_clients[i];
if (c->pending_ack && millisHasNowPassed(c->ack_timeout)) {
c->push_failures++;
c->pending_ack = 0; // reset (TODO: keep prev expected_ack's in a list, incase they arrive LATER, after we retry)
MESH_DEBUG_PRINTLN("pending ACK timed out: push_failures: %d", (uint32_t)c->push_failures);
}
}
// check next Round-Robin client, and sync next new post
auto client = &known_clients[next_client_idx];
bool did_push = false;
if (client->pending_ack == 0 && client->last_activity != 0 && client->push_failures < 3) { // not already waiting for ACK, AND not evicted, AND retries not max
MESH_DEBUG_PRINTLN("loop - checking for client %02X", (uint32_t) client->id.pub_key[0]);
for (int k = 0, idx = next_post_idx; k < MAX_UNSYNCED_POSTS; k++) {
if (posts[idx].post_timestamp > client->sync_since // is new post for this Client?
&& !posts[idx].author.matches(client->id)) { // don't push posts to the author
// push this post to Client, then wait for ACK
pushPostToClient(client, posts[idx]);
did_push = true;
MESH_DEBUG_PRINTLN("loop - pushed to client %02X: %s", (uint32_t) client->id.pub_key[0], posts[idx].text);
break;
}
idx = (idx + 1) % MAX_UNSYNCED_POSTS; // wrap to start of cyclic queue
}
} else {
MESH_DEBUG_PRINTLN("loop - skipping busy (or evicted) client %02X", (uint32_t) client->id.pub_key[0]);
}
next_client_idx = (next_client_idx + 1) % num_clients; // round robin polling for each client
if (did_push) {
next_push = futureMillis(SYNC_PUSH_INTERVAL);
} else {
// were no unsynced posts for curr client, so proccess next client much quicker! (in next loop())
next_push = futureMillis(SYNC_PUSH_INTERVAL / 8);
}
}
if (next_flood_advert && millisHasNowPassed(next_flood_advert)) {
mesh::Packet* pkt = createSelfAdvert();
if (pkt) sendFlood(pkt);
updateFloodAdvertTimer(); // schedule next flood advert
updateAdvertTimer(); // also schedule local advert (so they don't overlap)
} else if (next_local_advert && millisHasNowPassed(next_local_advert)) {
mesh::Packet* pkt = createSelfAdvert();
if (pkt) sendZeroHop(pkt);
updateAdvertTimer(); // schedule next local advert
}
#ifdef DISPLAY_CLASS
ui_task.loop();
#endif
// TODO: periodically check for OLD/inactive entries in known_clients[], and evict
}
};
StdRNG fast_rng;
SimpleMeshTables tables;
MyMesh the_mesh(board, radio_driver, *new ArduinoMillis(), fast_rng, rtc_clock, tables);
void halt() {
while (1) ;
}
static char command[MAX_POST_TEXT_LEN+1];
void setup() {
Serial.begin(115200);
delay(1000);
board.begin();
#ifdef DISPLAY_CLASS
if (display.begin()) {
display.startFrame();
display.print("Please wait...");
display.endFrame();
}
#endif
if (!radio_init()) { halt(); }
fast_rng.begin(radio_get_rng_seed());
FILESYSTEM* fs;
#if defined(NRF52_PLATFORM)
InternalFS.begin();
fs = &InternalFS;
IdentityStore store(InternalFS, "");
#elif defined(RP2040_PLATFORM)
LittleFS.begin();
fs = &LittleFS;
IdentityStore store(LittleFS, "/identity");
store.begin();
#elif defined(ESP32)
SPIFFS.begin(true);
fs = &SPIFFS;
IdentityStore store(SPIFFS, "/identity");
#else
#error "need to define filesystem"
#endif
if (!store.load("_main", the_mesh.self_id)) {
the_mesh.self_id = radio_new_identity(); // create new random identity
int count = 0;
while (count < 10 && (the_mesh.self_id.pub_key[0] == 0x00 || the_mesh.self_id.pub_key[0] == 0xFF)) { // reserved id hashes
the_mesh.self_id = radio_new_identity(); count++;
}
store.save("_main", the_mesh.self_id);
}
Serial.print("Room ID: ");
mesh::Utils::printHex(Serial, the_mesh.self_id.pub_key, PUB_KEY_SIZE); Serial.println();
command[0] = 0;
sensors.begin();
the_mesh.begin(fs);
#ifdef DISPLAY_CLASS
ui_task.begin(the_mesh.getNodePrefs(), FIRMWARE_BUILD_DATE, FIRMWARE_VERSION);
#endif
// send out initial Advertisement to the mesh
the_mesh.sendSelfAdvertisement(16000);
}
void loop() {
int len = strlen(command);
while (Serial.available() && len < sizeof(command)-1) {
char c = Serial.read();
if (c != '\n') {
command[len++] = c;
command[len] = 0;
}
Serial.print(c);
}
if (len == sizeof(command)-1) { // command buffer full
command[sizeof(command)-1] = '\r';
}
if (len > 0 && command[len - 1] == '\r') { // received complete line
command[len - 1] = 0; // replace newline with C string null terminator
char reply[160];
the_mesh.getCLI()->handleCommand(0, command, reply); // NOTE: there is no sender_timestamp via serial!
if (reply[0]) {
Serial.print(" -> "); Serial.println(reply);
}
command[0] = 0; // reset command buffer
}
the_mesh.loop();
sensors.loop();
}
+590
View File
@@ -0,0 +1,590 @@
#include <Arduino.h> // needed for PlatformIO
#include <Mesh.h>
#if defined(NRF52_PLATFORM)
#include <InternalFileSystem.h>
#elif defined(RP2040_PLATFORM)
#include <LittleFS.h>
#elif defined(ESP32)
#include <SPIFFS.h>
#endif
#include <helpers/ArduinoHelpers.h>
#include <helpers/StaticPoolPacketManager.h>
#include <helpers/SimpleMeshTables.h>
#include <helpers/IdentityStore.h>
#include <RTClib.h>
#include <target.h>
/* ---------------------------------- CONFIGURATION ------------------------------------- */
#define FIRMWARE_VER_TEXT "v2 (build: 4 Feb 2025)"
#ifndef LORA_FREQ
#define LORA_FREQ 915.0
#endif
#ifndef LORA_BW
#define LORA_BW 250
#endif
#ifndef LORA_SF
#define LORA_SF 10
#endif
#ifndef LORA_CR
#define LORA_CR 5
#endif
#ifndef LORA_TX_POWER
#define LORA_TX_POWER 20
#endif
#ifndef MAX_CONTACTS
#define MAX_CONTACTS 100
#endif
#include <helpers/BaseChatMesh.h>
#define SEND_TIMEOUT_BASE_MILLIS 500
#define FLOOD_SEND_TIMEOUT_FACTOR 16.0f
#define DIRECT_SEND_PERHOP_FACTOR 6.0f
#define DIRECT_SEND_PERHOP_EXTRA_MILLIS 250
#define PUBLIC_GROUP_PSK "izOH6cXN6mrJ5e26oRXNcg=="
// Believe it or not, this std C function is busted on some platforms!
static uint32_t _atoi(const char* sp) {
uint32_t n = 0;
while (*sp && *sp >= '0' && *sp <= '9') {
n *= 10;
n += (*sp++ - '0');
}
return n;
}
/* -------------------------------------------------------------------------------------- */
struct NodePrefs { // persisted to file
float airtime_factor;
char node_name[32];
double node_lat, node_lon;
float freq;
uint8_t tx_power_dbm;
uint8_t unused[3];
};
class MyMesh : public BaseChatMesh, ContactVisitor {
FILESYSTEM* _fs;
NodePrefs _prefs;
uint32_t expected_ack_crc;
ChannelDetails* _public;
unsigned long last_msg_sent;
ContactInfo* curr_recipient;
char command[512+10];
uint8_t tmp_buf[256];
char hex_buf[512];
const char* getTypeName(uint8_t type) const {
if (type == ADV_TYPE_CHAT) return "Chat";
if (type == ADV_TYPE_REPEATER) return "Repeater";
if (type == ADV_TYPE_ROOM) return "Room";
return "??"; // unknown
}
void loadContacts() {
if (_fs->exists("/contacts")) {
#if defined(RP2040_PLATFORM)
File file = _fs->open("/contacts", "r");
#else
File file = _fs->open("/contacts");
#endif
if (file) {
bool full = false;
while (!full) {
ContactInfo c;
uint8_t pub_key[32];
uint8_t unused;
uint32_t reserved;
bool success = (file.read(pub_key, 32) == 32);
success = success && (file.read((uint8_t *) &c.name, 32) == 32);
success = success && (file.read(&c.type, 1) == 1);
success = success && (file.read(&c.flags, 1) == 1);
success = success && (file.read(&unused, 1) == 1);
success = success && (file.read((uint8_t *) &reserved, 4) == 4);
success = success && (file.read((uint8_t *) &c.out_path_len, 1) == 1);
success = success && (file.read((uint8_t *) &c.last_advert_timestamp, 4) == 4);
success = success && (file.read(c.out_path, 64) == 64);
c.gps_lat = c.gps_lon = 0; // not yet supported
if (!success) break; // EOF
c.id = mesh::Identity(pub_key);
c.lastmod = 0;
if (!addContact(c)) full = true;
}
file.close();
}
}
}
void saveContacts() {
#if defined(NRF52_PLATFORM)
_fs->remove("/contacts");
File file = _fs->open("/contacts", FILE_O_WRITE);
#elif defined(RP2040_PLATFORM)
File file = _fs->open("/contacts", "w");
#else
File file = _fs->open("/contacts", "w", true);
#endif
if (file) {
ContactsIterator iter;
ContactInfo c;
uint8_t unused = 0;
uint32_t reserved = 0;
while (iter.hasNext(this, c)) {
bool success = (file.write(c.id.pub_key, 32) == 32);
success = success && (file.write((uint8_t *) &c.name, 32) == 32);
success = success && (file.write(&c.type, 1) == 1);
success = success && (file.write(&c.flags, 1) == 1);
success = success && (file.write(&unused, 1) == 1);
success = success && (file.write((uint8_t *) &reserved, 4) == 4);
success = success && (file.write((uint8_t *) &c.out_path_len, 1) == 1);
success = success && (file.write((uint8_t *) &c.last_advert_timestamp, 4) == 4);
success = success && (file.write(c.out_path, 64) == 64);
if (!success) break; // write failed
}
file.close();
}
}
void setClock(uint32_t timestamp) {
uint32_t curr = getRTCClock()->getCurrentTime();
if (timestamp > curr) {
getRTCClock()->setCurrentTime(timestamp);
Serial.println(" (OK - clock set!)");
} else {
Serial.println(" (ERR: clock cannot go backwards)");
}
}
void importCard(const char* command) {
while (*command == ' ') command++; // skip leading spaces
if (memcmp(command, "meshcore://", 11) == 0) {
command += 11; // skip the prefix
char *ep = strchr(command, 0); // find end of string
while (ep > command) {
ep--;
if (mesh::Utils::isHexChar(*ep)) break; // found tail end of card
*ep = 0; // remove trailing spaces and other junk
}
int len = strlen(command);
if (len % 2 == 0) {
len >>= 1; // halve, for num bytes
if (mesh::Utils::fromHex(tmp_buf, len, command)) {
importContact(tmp_buf, len);
return;
}
}
}
Serial.println(" error: invalid format");
}
protected:
float getAirtimeBudgetFactor() const override {
return _prefs.airtime_factor;
}
int calcRxDelay(float score, uint32_t air_time) const override {
return 0; // disable rxdelay
}
bool allowPacketForward(const mesh::Packet* packet) override {
return true;
}
void onDiscoveredContact(ContactInfo& contact, bool is_new) override {
// TODO: if not in favs, prompt to add as fav(?)
Serial.printf("ADVERT from -> %s\n", contact.name);
Serial.printf(" type: %s\n", getTypeName(contact.type));
Serial.print(" public key: "); mesh::Utils::printHex(Serial, contact.id.pub_key, PUB_KEY_SIZE); Serial.println();
saveContacts();
}
void onContactPathUpdated(const ContactInfo& contact) override {
Serial.printf("PATH to: %s, path_len=%d\n", contact.name, (int32_t) contact.out_path_len);
saveContacts();
}
bool processAck(const uint8_t *data) override {
if (memcmp(data, &expected_ack_crc, 4) == 0) { // got an ACK from recipient
Serial.printf(" Got ACK! (round trip: %d millis)\n", _ms->getMillis() - last_msg_sent);
// NOTE: the same ACK can be received multiple times!
expected_ack_crc = 0; // reset our expected hash, now that we have received ACK
return true;
}
//uint32_t crc;
//memcpy(&crc, data, 4);
//MESH_DEBUG_PRINTLN("unknown ACK received: %08X (expected: %08X)", crc, expected_ack_crc);
return false;
}
void onMessageRecv(const ContactInfo& from, mesh::Packet* pkt, uint32_t sender_timestamp, const char *text) override {
Serial.printf("(%s) MSG -> from %s\n", pkt->isRouteDirect() ? "DIRECT" : "FLOOD", from.name);
Serial.printf(" %s\n", text);
if (strcmp(text, "clock sync") == 0) { // special text command
setClock(sender_timestamp + 1);
}
}
void onCommandDataRecv(const ContactInfo& from, mesh::Packet* pkt, uint32_t sender_timestamp, const char *text) override {
}
void onSignedMessageRecv(const ContactInfo& from, mesh::Packet* pkt, uint32_t sender_timestamp, const uint8_t *sender_prefix, const char *text) override {
}
void onChannelMessageRecv(const mesh::GroupChannel& channel, mesh::Packet* pkt, uint32_t timestamp, const char *text) override {
if (pkt->isRouteDirect()) {
Serial.printf("PUBLIC CHANNEL MSG -> (Direct!)\n");
} else {
Serial.printf("PUBLIC CHANNEL MSG -> (Flood) hops %d\n", pkt->path_len);
}
Serial.printf(" %s\n", text);
}
uint8_t onContactRequest(const ContactInfo& contact, uint32_t sender_timestamp, const uint8_t* data, uint8_t len, uint8_t* reply) override {
return 0; // unknown
}
void onContactResponse(const ContactInfo& contact, const uint8_t* data, uint8_t len) override {
// not supported
}
uint32_t calcFloodTimeoutMillisFor(uint32_t pkt_airtime_millis) const override {
return SEND_TIMEOUT_BASE_MILLIS + (FLOOD_SEND_TIMEOUT_FACTOR * pkt_airtime_millis);
}
uint32_t calcDirectTimeoutMillisFor(uint32_t pkt_airtime_millis, uint8_t path_len) const override {
return SEND_TIMEOUT_BASE_MILLIS +
( (pkt_airtime_millis*DIRECT_SEND_PERHOP_FACTOR + DIRECT_SEND_PERHOP_EXTRA_MILLIS) * (path_len + 1));
}
void onSendTimeout() override {
Serial.println(" ERROR: timed out, no ACK.");
}
public:
MyMesh(mesh::Radio& radio, StdRNG& rng, mesh::RTCClock& rtc, SimpleMeshTables& tables)
: BaseChatMesh(radio, *new ArduinoMillis(), rng, rtc, *new StaticPoolPacketManager(16), tables)
{
// defaults
memset(&_prefs, 0, sizeof(_prefs));
_prefs.airtime_factor = 2.0; // one third
strcpy(_prefs.node_name, "NONAME");
_prefs.freq = LORA_FREQ;
_prefs.tx_power_dbm = LORA_TX_POWER;
command[0] = 0;
curr_recipient = NULL;
}
float getFreqPref() const { return _prefs.freq; }
uint8_t getTxPowerPref() const { return _prefs.tx_power_dbm; }
void begin(FILESYSTEM& fs) {
_fs = &fs;
BaseChatMesh::begin();
#if defined(NRF52_PLATFORM)
IdentityStore store(fs, "");
#elif defined(RP2040_PLATFORM)
IdentityStore store(fs, "/identity");
store.begin();
#else
IdentityStore store(fs, "/identity");
#endif
if (!store.load("_main", self_id, _prefs.node_name, sizeof(_prefs.node_name))) { // legacy: node_name was from identity file
// Need way to get some entropy to seed RNG
Serial.println("Press ENTER to generate key:");
char c = 0;
while (c != '\n') { // wait for ENTER to be pressed
if (Serial.available()) c = Serial.read();
}
((StdRNG *)getRNG())->begin(millis());
self_id = mesh::LocalIdentity(getRNG()); // create new random identity
int count = 0;
while (count < 10 && (self_id.pub_key[0] == 0x00 || self_id.pub_key[0] == 0xFF)) { // reserved id hashes
self_id = mesh::LocalIdentity(getRNG()); count++;
}
store.save("_main", self_id);
}
// load persisted prefs
if (_fs->exists("/node_prefs")) {
#if defined(RP2040_PLATFORM)
File file = _fs->open("/node_prefs", "r");
#else
File file = _fs->open("/node_prefs");
#endif
if (file) {
file.read((uint8_t *) &_prefs, sizeof(_prefs));
file.close();
}
}
loadContacts();
_public = addChannel("Public", PUBLIC_GROUP_PSK); // pre-configure Andy's public channel
}
void savePrefs() {
#if defined(NRF52_PLATFORM)
_fs->remove("/node_prefs");
File file = _fs->open("/node_prefs", FILE_O_WRITE);
#elif defined(RP2040_PLATFORM)
File file = _fs->open("/node_prefs", "w");
#else
File file = _fs->open("/node_prefs", "w", true);
#endif
if (file) {
file.write((const uint8_t *)&_prefs, sizeof(_prefs));
file.close();
}
}
void showWelcome() {
Serial.println("===== MeshCore Chat Terminal =====");
Serial.println();
Serial.printf("WELCOME %s\n", _prefs.node_name);
mesh::Utils::printHex(Serial, self_id.pub_key, PUB_KEY_SIZE);
Serial.println();
Serial.println(" (enter 'help' for basic commands)");
Serial.println();
}
void sendSelfAdvert(int delay_millis) {
auto pkt = createSelfAdvert(_prefs.node_name, _prefs.node_lat, _prefs.node_lon);
if (pkt) {
sendFlood(pkt, delay_millis);
}
}
// ContactVisitor
void onContactVisit(const ContactInfo& contact) override {
Serial.printf(" %s - ", contact.name);
char tmp[40];
int32_t secs = contact.last_advert_timestamp - getRTCClock()->getCurrentTime();
AdvertTimeHelper::formatRelativeTimeDiff(tmp, secs, false);
Serial.println(tmp);
}
void handleCommand(const char* command) {
while (*command == ' ') command++; // skip leading spaces
if (memcmp(command, "send ", 5) == 0) {
if (curr_recipient) {
const char *text = &command[5];
uint32_t est_timeout;
int result = sendMessage(*curr_recipient, getRTCClock()->getCurrentTime(), 0, text, expected_ack_crc, est_timeout);
if (result == MSG_SEND_FAILED) {
Serial.println(" ERROR: unable to send.");
} else {
last_msg_sent = _ms->getMillis();
Serial.printf(" (message sent - %s)\n", result == MSG_SEND_SENT_FLOOD ? "FLOOD" : "DIRECT");
}
} else {
Serial.println(" ERROR: no recipient selected (use 'to' cmd).");
}
} else if (memcmp(command, "public ", 7) == 0) { // send GroupChannel msg
uint8_t temp[5+MAX_TEXT_LEN+32];
uint32_t timestamp = getRTCClock()->getCurrentTime();
memcpy(temp, &timestamp, 4); // mostly an extra blob to help make packet_hash unique
temp[4] = 0; // attempt and flags
sprintf((char *) &temp[5], "%s: %s", _prefs.node_name, &command[7]); // <sender>: <msg>
temp[5 + MAX_TEXT_LEN] = 0; // truncate if too long
int len = strlen((char *) &temp[5]);
auto pkt = createGroupDatagram(PAYLOAD_TYPE_GRP_TXT, _public->channel, temp, 5 + len);
if (pkt) {
sendFlood(pkt);
Serial.println(" Sent.");
} else {
Serial.println(" ERROR: unable to send");
}
} else if (memcmp(command, "list", 4) == 0) { // show Contact list, by most recent
int n = 0;
if (command[4] == ' ') { // optional param, last 'N'
n = atoi(&command[5]);
}
scanRecentContacts(n, this);
} else if (strcmp(command, "clock") == 0) { // show current time
uint32_t now = getRTCClock()->getCurrentTime();
DateTime dt = DateTime(now);
Serial.printf( "%02d:%02d - %d/%d/%d UTC\n", dt.hour(), dt.minute(), dt.day(), dt.month(), dt.year());
} else if (memcmp(command, "time ", 5) == 0) { // set time (to epoch seconds)
uint32_t secs = _atoi(&command[5]);
setClock(secs);
} else if (memcmp(command, "to ", 3) == 0) { // set current recipient
curr_recipient = searchContactsByPrefix(&command[3]);
if (curr_recipient) {
Serial.printf(" Recipient %s now selected.\n", curr_recipient->name);
} else {
Serial.println(" Error: Name prefix not found.");
}
} else if (strcmp(command, "to") == 0) { // show current recipient
if (curr_recipient) {
Serial.printf(" Current: %s\n", curr_recipient->name);
} else {
Serial.println(" Err: no recipient selected");
}
} else if (strcmp(command, "advert") == 0) {
auto pkt = createSelfAdvert(_prefs.node_name, _prefs.node_lat, _prefs.node_lon);
if (pkt) {
sendZeroHop(pkt);
Serial.println(" (advert sent, zero hop).");
} else {
Serial.println(" ERR: unable to send");
}
} else if (strcmp(command, "reset path") == 0) {
if (curr_recipient) {
resetPathTo(*curr_recipient);
saveContacts();
Serial.println(" Done.");
}
} else if (memcmp(command, "card", 4) == 0) {
Serial.printf("Hello %s\n", _prefs.node_name);
auto pkt = createSelfAdvert(_prefs.node_name, _prefs.node_lat, _prefs.node_lon);
if (pkt) {
uint8_t len = pkt->writeTo(tmp_buf);
releasePacket(pkt); // undo the obtainNewPacket()
mesh::Utils::toHex(hex_buf, tmp_buf, len);
Serial.println("Your MeshCore biz card:");
Serial.print("meshcore://"); Serial.println(hex_buf);
Serial.println();
} else {
Serial.println(" Error");
}
} else if (memcmp(command, "import ", 7) == 0) {
importCard(&command[7]);
} else if (memcmp(command, "set ", 4) == 0) {
const char* config = &command[4];
if (memcmp(config, "af ", 3) == 0) {
_prefs.airtime_factor = atof(&config[3]);
savePrefs();
Serial.println(" OK");
} else if (memcmp(config, "name ", 5) == 0) {
StrHelper::strncpy(_prefs.node_name, &config[5], sizeof(_prefs.node_name));
savePrefs();
Serial.println(" OK");
} else if (memcmp(config, "lat ", 4) == 0) {
_prefs.node_lat = atof(&config[4]);
savePrefs();
Serial.println(" OK");
} else if (memcmp(config, "lon ", 4) == 0) {
_prefs.node_lon = atof(&config[4]);
savePrefs();
Serial.println(" OK");
} else if (memcmp(config, "tx ", 3) == 0) {
_prefs.tx_power_dbm = atoi(&config[3]);
savePrefs();
Serial.println(" OK - reboot to apply");
} else if (memcmp(config, "freq ", 5) == 0) {
_prefs.freq = atof(&config[5]);
savePrefs();
Serial.println(" OK - reboot to apply");
} else {
Serial.printf(" ERROR: unknown config: %s\n", config);
}
} else if (memcmp(command, "ver", 3) == 0) {
Serial.println(FIRMWARE_VER_TEXT);
} else if (memcmp(command, "help", 4) == 0) {
Serial.println("Commands:");
Serial.println(" set {name|lat|lon|freq|tx|af} {value}");
Serial.println(" card");
Serial.println(" import {biz card}");
Serial.println(" clock");
Serial.println(" time <epoch-seconds>");
Serial.println(" list {n}");
Serial.println(" to <recipient name or prefix>");
Serial.println(" to");
Serial.println(" send <text>");
Serial.println(" advert");
Serial.println(" reset path");
Serial.println(" public <text>");
} else {
Serial.print(" ERROR: unknown command: "); Serial.println(command);
}
}
void loop() {
BaseChatMesh::loop();
int len = strlen(command);
while (Serial.available() && len < sizeof(command)-1) {
char c = Serial.read();
if (c != '\n') {
command[len++] = c;
command[len] = 0;
}
Serial.print(c);
}
if (len == sizeof(command)-1) { // command buffer full
command[sizeof(command)-1] = '\r';
}
if (len > 0 && command[len - 1] == '\r') { // received complete line
command[len - 1] = 0; // replace newline with C string null terminator
handleCommand(command);
command[0] = 0; // reset command buffer
}
}
};
StdRNG fast_rng;
SimpleMeshTables tables;
MyMesh the_mesh(radio_driver, fast_rng, *new VolatileRTCClock(), tables); // TODO: test with 'rtc_clock' in target.cpp
void halt() {
while (1) ;
}
void setup() {
Serial.begin(115200);
board.begin();
if (!radio_init()) { halt(); }
fast_rng.begin(radio_get_rng_seed());
#if defined(NRF52_PLATFORM)
InternalFS.begin();
the_mesh.begin(InternalFS);
#elif defined(RP2040_PLATFORM)
LittleFS.begin();
the_mesh.begin(LittleFS);
#elif defined(ESP32)
SPIFFS.begin(true);
the_mesh.begin(SPIFFS);
#else
#error "need to define filesystem"
#endif
radio_set_params(the_mesh.getFreqPref(), LORA_BW, LORA_SF, LORA_CR);
radio_set_tx_power(the_mesh.getTxPowerPref());
the_mesh.showWelcome();
// send out initial Advertisement to the mesh
the_mesh.sendSelfAdvert(1200); // add slight delay
}
void loop() {
the_mesh.loop();
}
-1338
View File
File diff suppressed because it is too large. Load diff
+39
View File
@@ -0,0 +1,39 @@
This directory is intended for project header files.
A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.
```src/main.c
#include "header.h"
int main (void)
{
...
}
```
Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.
In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.
Read more about using header files in official GCC documentation:
* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
-894
View File
@@ -1,894 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-terminal-4.8.0">
<meta name="description" content="MeshCore fork meshcore-tth -- repeater antispam, diagnostics, OTA, Czech mesh defaults">
<link rel="canonical" href="https://tth-pub.pages.rfa.cz/meshcore-tth/"><link rel="icon" type="image/png" sizes="192x192" href="img/android-chrome-192x192.png" />
<link rel="icon" type="image/png" sizes="512x512" href="img/android-chrome-512x512.png" />
<link rel="apple-touch-icon" sizes="180x180" href="img/apple-touch-icon.png" />
<link rel="shortcut icon" type="image/png" sizes="48x48" href="img/favicon.ico" />
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon-16x16.png" />
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon-32x32.png" />
<title>About the fork - MeshCore TTH</title>
<link href="css/fontawesome/css/fontawesome.min.css" rel="stylesheet">
<link href="css/fontawesome/css/solid.min.css" rel="stylesheet">
<link href="css/normalize.css" rel="stylesheet">
<link href="css/terminal.css" rel="stylesheet">
<link href="css/theme.css" rel="stylesheet">
<link href="css/theme.tile_grid.css" rel="stylesheet">
<link href="css/theme.footer.css" rel="stylesheet">
<!-- dark color palette -->
<link href="css/palettes/dark.css" rel="stylesheet">
<!-- page layout -->
<style>
/* initially set page layout to a one column grid */
.terminal-mkdocs-main-grid {
display: grid;
grid-column-gap: 1.4em;
grid-template-columns: auto;
grid-template-rows: auto;
}
/*
* when side navigation is not hidden, use a two column grid.
* if the screen is too narrow, fall back to the initial one column grid layout.
* in this case the main content will be placed under the navigation panel.
*/
@media only screen and (min-width: 70em) {
.terminal-mkdocs-main-grid {
grid-template-columns: 4fr 9fr;
}
}</style>
<!-- cursor_animation override -->
<style>
#mkdocs-terminal-site-name.terminal-prompt::after {
display: none;
}
</style>
<link href="_stylesheets/tth.css" rel="stylesheet">
<!-- search css support -->
<link href="css/search/bootstrap-modal.css" rel="stylesheet">
<!-- search scripts -->
<script>
var base_url = ".",
shortcuts = "{}";
</script>
<script src="js/jquery/jquery-1.10.1.min.js" defer></script>
<script src="js/bootstrap/bootstrap.min.js" defer></script>
<script src="js/mkdocs/base.js" defer></script>
<script src="search/main.js"></script>
</head>
<body class="terminal"><div class="container">
<div class="terminal-nav">
<header class="terminal-logo">
<div id="mkdocs-terminal-site-name" class="logo terminal-prompt"><a href="https://tth-pub.pages.rfa.cz/meshcore-tth/" class="no-style">MeshCore TTH</a></div>
</header>
<nav class="terminal-menu">
<ul vocab="https://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
<a href="." class="menu-item active" property="item" typeof="WebPage">
<span property="name">About the fork</span>
</a>
<meta property="position" content="0">
</li>
<li property="itemListElement" typeof="ListItem">
<a href="cs/" class="menu-item " property="item" typeof="WebPage">
<span property="name">Česky</span>
</a>
<meta property="position" content="1">
</li>
<li property="itemListElement" typeof="ListItem">
<a href="#" class="menu-item" data-toggle="modal" data-target="#mkdocs_search_modal" property="item" typeof="SearchAction">
<i aria-hidden="true" class="fa fa-search"></i> <span property="name">Search</span>
</a>
<meta property="position" content="2">
</li>
</ul>
</nav>
</div>
</div>
<div class="container">
<div class="terminal-mkdocs-main-grid"><aside id="terminal-mkdocs-side-panel"><nav>
<ul class="terminal-mkdocs-side-nav-items">
<li class="terminal-mkdocs-side-nav-li">
<span class="terminal-mkdocs-side-nav-item--active">About the fork</span>
</li>
<li class="terminal-mkdocs-side-nav-li">
<a class="terminal-mkdocs-side-nav-item" href="cs/">Česky</a>
</li>
<li class="terminal-mkdocs-side-nav-li">
<span class="
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">Fork meshcore-tth</span>
<ul class="terminal-mkdocs-side-nav-li-ul">
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="tth-commands/">Console commands</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="ota/">Firmware update by the admin (OTA)</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="power/">Power saving</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="budka-sensor/">Budka as a sensor</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="ble-lora-coexistence/">BLE/LoRa coexistence</a>
</li>
</ul>
</li>
<li class="terminal-mkdocs-side-nav-li">
<span class="
terminal-mkdocs-side-nav-item terminal-mkdocs-side-nav-section-no-index">MeshCore (upstream)</span>
<ul class="terminal-mkdocs-side-nav-li-ul">
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="meshcore/">Introduction</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="faq/">FAQ</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="cli_commands/">CLI commands</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="companion_cli/">Companion CLI</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="companion_protocol/">Companion protocol</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="terminal_chat_cli/">Terminal chat CLI</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="kiss_modem_protocol/">KISS modem protocol</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="packet_format/">Packet format</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="payloads/">Payloads</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="stats_binary_frames/">Stats binary frames</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="number_allocations/">Number allocations</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="qr_codes/">QR codes</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="radio_presets/">Radio presets</a>
</li>
<li class="terminal-mkdocs-side-nav-li-ul-li">
<a class="terminal-mkdocs-side-nav-item" href="nrf52_power_management/">nRF52 power management</a>
</li>
</ul>
</li>
</ul>
</nav><hr>
<nav>
<ul>
<li><a href="#about-this-fork-meshcore-tth">About this fork (meshcore-tth)</a></li>
<li><a href="#repeater-antispam-all-of-it-off-switchable-none-of-it-upstream">Repeater: antispam (all of it off-switchable, none of it upstream)</a></li><li><a href="#diagnostics-and-operations">Diagnostics and operations</a></li><li><a href="#core-fixes">Core fixes</a></li><li><a href="#power-clock-gps">Power, clock, GPS</a></li><li><a href="#sensors-and-companions">Sensors and companions</a></li><li><a href="#public-builds-czech-mesh-defaults">Public builds: Czech mesh defaults</a></li><li><a href="#flashing-a-release">Flashing a release</a></li><li><a href="#experimental-firmware-update-pushed-by-the-admin-ota">Experimental: firmware update pushed by the admin (*-ota)</a></li><li><a href="#build">Build</a></li>
</ul>
</nav>
</aside>
<main id="terminal-mkdocs-main-content">
<section id="mkdocs-terminal-content">
<h1 id="about-this-fork-meshcore-tth">About this fork (meshcore-tth)</h1>
<p><em><a href="cs/">Česká verze</a>.</em></p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p><strong>Experimental firmware -- not meant for regular users.</strong> This fork and all
its releases are a personal development branch for the nodes of one small
network: a rolling release on upstream <code>dev</code>, built automatically about
twice a day, with no stable channel, no support, and tried only on our own
boards. It may carry bugs that take a node out of service, and getting one
back then needs USB or BLE in hand. For everyday use flash the official
MeshCore (<a href="https://flasher.meshcore.io">flasher.meshcore.io</a>).</p>
</div>
<p>A fork of <a href="https://github.com/meshcore-dev/MeshCore">meshcore-dev/MeshCore</a>
that runs the repeaters, sensors and bench boards of a small Czech network on
the CZ mesh (869.432 MHz). Upstream <code>main</code> and <code>dev</code> are merged automatically
twice a day; everything below is on top of that. Our code is marked
<code>CUSTOM (TeTeHacko)</code> in the source. Nothing here changes the wire protocol.</p>
<h2 id="repeater-antispam-all-of-it-off-switchable-none-of-it-upstream">Repeater: antispam (all of it off-switchable, none of it upstream)</h2>
<p><strong>After flashing only the FairnessLimiter is on</strong>, with limits about twice
above 30 days of real CZ mesh traffic: per channel a burst of 100 messages,
then one per 30 s; per sender 150 and one per 10 s; per advert origin 30 and
one per 10 min. It is a net for runaway floods, not a quota; <code>fairness off</code>
switches it off for good. The advert window, the filters and dry-run stay
off until you turn them on.</p>
<ul>
<li><strong>FairnessLimiter</strong> -- token buckets on forwarded floods, keyed on the 1-byte
ids already in the clear (channel hash, sender hash, advert origin). Port of
Beanow's proposal <a href="https://github.com/meshcore-dev/MeshCore/pull/1502">#1502</a>,
limits re-sized from 30 days of real CZ traffic.
<code>fairness [on|off|grid|cap|refill]</code>; direct-routed traffic is never limited.</li>
<li><strong>Per-origin advert window</strong> -- each node's flood advert forwarded at most
once per N hours (<code>fairness advert &lt;h&gt;|clear</code>), ported from
<a href="https://github.com/Dutch-MeshCore/MeshCore">DutchMeshCore</a>'s AdvertLimiter.
Aimed at nodes that re-advertise every minute.</li>
<li><strong>Dry-run</strong> -- <code>fairness dryrun on</code> counts every verdict but forwards anyway;
<code>fairness air</code> reports the airtime shed (or that would be) per reason.</li>
<li><strong>Channel filter</strong> -- on channels whose key the repeater knows (Public and
<code>#hashtag</code> channels), stop forwarding messages of listed sender names
(<code>filter add|del|list</code>). Names are spoofable: it contains a runaway bot,
it is not security.</li>
<li><strong>Channel-hash deny-forward</strong> -- <code>filter hash add &lt;hex&gt; [secs]</code>: keyless,
works on private channels too; reception is unaffected, only forwarding.
With <code>secs</code> the channel is throttled (one packet per <code>secs</code>) instead of cut.</li>
<li><strong>Message age limit</strong> -- <code>filter age &lt;min&gt;|off</code> (opt-in, 1-10080 min): do not
forward group texts on the decrypted channels whose sender timestamp is
older; inactive while the repeater clock is unset. It judges the sender's
clock, so companions without a time sync are dropped too -- keep it in days.</li>
<li><code>filter dryrun on</code> counts every <code>filter</code> verdict but forwards anyway.</li>
</ul>
<h2 id="diagnostics-and-operations">Diagnostics and operations</h2>
<p>Every command of the fork, which builds have it and the defaults:
<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/tth-commands.md">docs/tth-commands.md</a>.</p>
<p>Repeater, room server and sensor (everything with a text console) have:</p>
<ul>
<li><strong>Radio watchdogs.</strong> The hardware watchdog only catches a frozen loop; two
of our nodes were found deaf with the loop running, and only a reboot
helped.</li>
<li><code>set radio.silence &lt;min&gt;</code> -- <strong>deaf receiver</strong>: when the received-frame
counter does not move for <code>&lt;min&gt;</code> minutes (a frame with a CRC error
counts), the node re-arms its receiver first and reboots if that does not
help either. Each such reboot doubles the threshold for the next boot (up
to 16x) and the first frame received resets it, so a quiet site does not
end in a reboot loop. Saved; <strong>off by default</strong> (<code>0</code>) -- pick a threshold
well above the longest normal quiet spell of the site.</li>
<li><strong>Stalled TX</strong> (repeater only): packets wait in the queue and the sent
counter does not move -&gt; re-arm the radio, then reboot. An empty queue
never counts. <strong>On, 15 min</strong> (<code>RADIO_TXSTALL_MIN</code>); <code>set radio.txstall
&lt;min&gt;|off</code> holds until the next reboot.</li>
<li><code>get radio.reboots</code> -- reboots done by the watchdogs (survives power
loss); <code>get boot</code> -- why the board last reset, and the hardfault record
(also printed at boot).</li>
<li><code>dfu [uf2|serial|ota]</code> -- a deterministic reboot into the bootloader (local
console only); <code>i2c</code> -- bus scan.</li>
</ul>
<p>The repeater also has:</p>
<ul>
<li><code>blink</code> (flashes the LED, also over the mesh -- finds a node on a mast),
<code>txpwr</code> (TX power until reboot, with RadioLib's verdict), TX-failure
counters in the status reply.</li>
<li>Observer variants only (<code>*-observer</code>): text console over BLE next to USB,
<code>ble on|off</code> saved across reboots (<code>RPT_BLE_DEFAULT_OFF</code>: starts off), own
BLE PIN (<code>ble pin</code>), persisted connection TX power (<code>blepwr</code>), <code>bleconn</code>, a
non-blocking BLE TX pump and connection parameters that hold on a weak
link.</li>
<li>Also observer variants only: a passive analyzer in the console --
<code>nodes</code> (heard repeaters/rooms, multi-path join key), <code>rxlog</code> (every frame
heard, type/path/SNR/RSSI), <code>pktlog</code> (raw frames for an observer feed), big
paged replies.</li>
<li>Own builds only, not in the releases:</li>
<li>channel bot (<code>BOT_CHANNEL_PSK</code>: <code>!link</code>, <code>!path</code>, <code>!snr</code>, <code>!heard</code>,
<code>!noise</code>, <code>!ping</code>, <code>!help</code>, narrowed by <code>BOT_COMMANDS</code>, per-sender
cooldown, ignore list) -- answers without repeating;</li>
<li><code>RADIO_DIAG</code>: <code>radiostat</code> (SX1262 receiver state, hands off) and
<code>radiokick rx|clrirq|standby|agc</code> (one recovery step at a time, gentlest
first -- the first that helps names the broken layer);</li>
<li><code>PIN_DIAG</code>: <code>dio1</code> (the chip's IRQ status against the level on the pin --
which end of a dead DIO1 line is broken);</li>
<li><code>LORA_POLL_IRQ</code>: DIO1-less operation for a board with a dead IRQ line.</li>
</ul>
<h2 id="core-fixes">Core fixes</h2>
<ul>
<li><strong>Replay protection of admin commands survives a reboot.</strong> Upstream keeps a
client's last timestamp in RAM only, so after every restart any captured
command is accepted again -- a captured <code>reboot</code> reboots the node forever.
Repeater, room server and sensor now write it to flash before acting on the
command (<code>/s_acl_ts0|1</code>, alternating with a checksum, so a power cut mid-write
does not lose it). A timestamp more than a day ahead of the node's clock
(<code>ACL_TS_MAX_AHEAD</code>) is accepted but not stored, so a companion with a runaway
clock cannot lock its admin out. Only admins are stored: a guest can only
read, and with the empty guest password anybody is one, so its every
request would be a flash write. Nothing changes for clients.</li>
<li><strong>Passwords can no longer be guessed over the air at full speed.</strong> Upstream
checks every login without a limit and does not even answer a wrong one.
After 4 wrong passwords within 3 minutes (<code>LOGIN_FAIL_MAX</code>,
<code>LOGIN_FAIL_SECS</code>) no password is checked until the window ends. A client
that is already an admin in the ACL always gets through -- nobody else can
send a login in its name, so the attack cannot lock the admins out.</li>
<li><strong>A replayed blank-password login no longer floods a reply.</strong> A login from a
client in the ACL with an empty password had no replay check; replayed, it
gained nothing, but every copy made the node flood its reply over the mesh.</li>
<li>TRACE no longer appends its path past the end of the payload; TRACE/PATH
parsing and <code>Packet::readFrom</code> are bounds-checked.</li>
<li><code>markSeen</code> is idempotent again (the send path was eating the dedup window).</li>
<li><code>calcMaxPacketMillis</code> fallback no longer underflows (a node went deaf on it).</li>
<li>Path-hash width comes from the node's prefs on every TX path, including
<code>sendZeroHop</code>; 2-byte path hashes are the default (<code>PATH_HASH_MODE_DEFAULT</code>).</li>
<li>Failed transmits are re-queued with backoff instead of dropped.</li>
<li>Per-packet RSSI captured at RX; <code>ContactInfo</code> zeroed before a partial fill.</li>
</ul>
<h2 id="power-clock-gps">Power, clock, GPS</h2>
<ul>
<li>GPS duty cycle (<code>gps duty</code>), also on the T1000-E, which had none: the
receiver runs only around a clock sync (once a day, after a window without
a fix again in 6 h). A position request warms it for the next request.</li>
<li>A node without GPS starts at its build epoch, not in 2024; the clock and a
hardfault record survive a warm reset (<code>.noinit</code>); <code>clkreboot</code>.</li>
<li>No blinking LED and slower BLE advertising on solar nodes.</li>
<li>Battery level as an icon at the end of the advertised name: <code>set batt.icon
on</code>, thresholds <code>set batt.icon.lo|hi &lt;mV&gt;</code> (off by default; a long name has
no room for it and the command says so).</li>
<li>Optional RX duty cycle (<code>set radio.rxps off|on|balanced|max</code>, finer
<code>level &lt;1-10&gt;</code>; ported from EasySkyMesh PowerSaving): the SX1262 sleeps
between short listening windows. Built into the public releases and
<strong>off</strong>; <code>max</code> saved ~2.3 mA on the bench with no packet loss
(<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/power.md">docs/power.md</a>), but on the live mesh one of our masts lost
16 % of its reception -- switch it on with care. SX1262 only, not the LR1110
(T1000-E).</li>
<li>The nRF52 boot undervoltage lock (<code>PWRMGT_VOLTAGE_BOOTLOCK</code>) is <strong>off</strong>,
as in upstream since v1.18.0
(<a href="https://github.com/meshcore-dev/MeshCore/pull/2377">#2377</a>): its fixed
3.3 V threshold kept LiFePO4 and LTO nodes from booting. The firmware boots
on any cell chemistry; deep-discharge protection is up to the BMS or the
cell's protection board. A configurable, chemistry-aware lock is waiting
for upstream (<a href="https://github.com/meshcore-dev/MeshCore/pull/2088">#2088</a>). The exception
is <code>SenseCap_Solar_repeater</code> (Li-ion, our masts): the lock is on and both
thresholds are settable at runtime, also as an admin over the mesh --
<code>set pwr.bootlock &lt;mV&gt;|off</code> (default 3300; below it the node does not start
and sleeps until the cell recovers) and <code>set pwr.cutoff &lt;mV&gt;|off</code> (default
off; below it a running node switches off); <code>get pwr</code>
(<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/power.md">docs/power.md</a>).</li>
</ul>
<h2 id="sensors-and-companions">Sensors and companions</h2>
<ul>
<li><code>simple_sensor</code>: telemetry from an external station over UART
(<code>BudkaLinkSensorManager</code>, one LPP channel per meter), <code>sensor read</code>.</li>
<li>Sensors that would otherwise convert continuously (INA219, INA226, INA260,
INA3221, BMP280) sleep between telemetry reads and measure on demand (idea
and first INA219 patch: Alkel Brostl). INA chips are told apart by their ID,
so an INA226 is no longer taken for an INA219. The shunt is set at runtime
and saved: <code>sensor set ina.shunt &lt;mOhm&gt;</code>.</li>
<li>Companion: <code>gps duty</code> persists, bounded build-date copy. Private key
export, reading the BLE PIN and changing it (CLI <code>set pin</code> included) work
only over paired BLE, never over USB, a UART or WiFi/TCP, and the reply that
carries the key or PIN goes back only where the request came from. (The
v1.17 merge had silently disabled that gate; a build without BLE still
trusts its one transport.) KISS modem: off-by-one in the name clamp.</li>
</ul>
<h2 id="public-builds-czech-mesh-defaults">Public builds: Czech mesh defaults</h2>
<p>Releases built from this repository (<code>pub-release</code>) come preset for the
Czech mesh, following the <a href="https://meshcore.cz/">meshcore.cz</a> wiki, so a
freshly flashed node does not need the usual round of settings:</p>
<ul>
<li>radio 869.432 MHz / 62.5 kHz / SF7 / CR5 (all builds);</li>
<li>repeater and room server: zero-hop advert off, flood advert every 25 h,
10 % duty cycle (<code>get dutycycle</code> → <code>10.0%</code>; the deprecated <code>af</code> reads 9);</li>
<li>repeater: regions <code>cz</code> and <code>cs</code> next to <code>*</code> -- add your own <code>cz-&lt;kraj&gt;</code>
with <code>region put cz-xxx cz</code> + <code>region save</code>;</li>
<li>2-byte path hashes (this fork's default);</li>
<li>repeater: the channel filter (<code>filter add &lt;name&gt;</code>) is built in for Public,
<code>#meshcore</code> and <code>#test</code>, with an empty list -- it does nothing until you
add a name.</li>
</ul>
<p>They apply only to a node with no saved settings (new, or after an erase):
a reflash keeps whatever the node already has, and regions you removed and
saved stay removed. Set a name and an admin password yourself.</p>
<p><strong>The companion's BLE PIN is the public <code>123456</code></strong> (boards with a display
draw their own and show it). Whoever pairs with it owns the companion:
messages, contacts, private key export. So change it in the app after the
first pairing. And with the board in hand neither the PIN nor a password
protects anything: the flash is not locked and the bootloader takes any
firmware. Treat a lost or stolen node as compromised -- for a repeater,
change the admin password wherever it was the same and drop its key from
ACLs; for a companion, treat the channels it held as known.</p>
<p>Observer variants (<code>*_repeater-observer-*</code>) of the nRF52 repeaters (XIAO,
SenseCAP Solar, RAK4631, T1000-E, Heltec T114) add the <code>nodes</code> / <code>rxlog</code> /
<code>pktlog</code> rings and a text console over BLE, for reading the repeater over
USB or BLE (<a href="https://git.rfa.cz/tth-pub/meshcore-repeater-observer">meshcore-repeater-observer</a>).
The BLE console is <strong>off</strong> after flashing (<code>RPT_BLE_DEFAULT_OFF</code>). It has no
login of its own, only the BLE PIN, and the build's PIN is the public
placeholder <code>123456</code>. So first set your own -- in the USB console, or as
admin over the mesh (remote CLI in the app): <code>ble pin &lt;6 digits&gt;</code> (saved, survives a reboot and a reflash; it also drops
every existing bond, so paired devices pair again). Only then <code>ble on</code> --
these builds refuse it while the PIN is still the placeholder. <code>ble</code> shows
whether the PIN is <code>own</code> or <code>build default</code>, never the PIN itself. Releases
up to <code>tth-654d53f3</code> do not have <code>ble pin</code>: keep BLE off there and use USB.</p>
<h2 id="flashing-a-release">Flashing a release</h2>
<p>Every release is an automatic build on upstream <code>dev</code> (see the warning
above), not a stable version. Flash it only on nodes you can reach, and each
new release on one of them first.</p>
<p>Files are in <a href="https://git.rfa.cz/tth-pub/meshcore-tth/releases">Releases</a>.
A release is named after the upstream version and the date, e.g.
<code>v1.18.0+tth.20261112</code> (a second one that day <code>.2</code>), and its notes list the
changes since the previous release. One set per board and role
(<code>&lt;board&gt;_&lt;role&gt;-&lt;release&gt;</code>, e.g. <code>Xiao_nrf52_repeater-v1.18.0+tth.20261112.zip</code>):
<code>.zip</code> and <code>.uf2</code> for nRF52 boards, <code>.bin</code> for ESP32 (<code>-merged.bin</code> is the
full image for a blank board, the plain <code>.bin</code> an update). <code>SHA256SUMS</code> lists
the checksums. Releases up to 12. 11. 2026 were named <code>tth-&lt;sha&gt;</code>.</p>
<p><strong>nRF52 (XIAO, RAK4631, SenseCAP Solar, T1000-E, T114) with the
<a href="https://flasher.meshcore.io">MeshCore web flasher</a></strong> -- Chrome, Edge or
Chromium on a computer (Web Serial; not Firefox or Safari):</p>
<ol>
<li>Connect the board over USB.</li>
<li>Click <strong>Custom Firmware</strong> and choose the <code>.zip</code> for your board.</li>
<li>Click <strong>Enter DFU mode</strong> and pick the board's serial port. The board
restarts into its bootloader and shows up as a new port.</li>
<li>Click <strong>Flash!</strong> and pick that new port. About 30 s, then the board
restarts into the new firmware.</li>
<li><strong>Console</strong> in the flasher (or any serial terminal, 115200) checks the
result: <code>ver</code> shows <code>v1.xx.x-tth&lt;sha&gt;</code>, the same as the "Verze v uzlu"
(node version) line in the release notes.</li>
</ol>
<p><strong>Do not click Erase Flash</strong> unless you want a new node: it wipes the
identity (the node's key and everything that knows it) together with all
settings. A plain flash keeps them.</p>
<p>Tried on a XIAO (repeater-observer, 3. 11. 2026). ESP32 <code>.bin</code> through the
same Custom Firmware button is untested here.</p>
<p>Without the web flasher: on most boards a double-tap of reset opens the
bootloader as a USB drive; copy the <code>.uf2</code> onto it. Or
<code>adafruit-nrfutil dfu serial -pkg &lt;file&gt;.zip -p &lt;port&gt; -b 115200</code> with the
board in the bootloader.</p>
<p>After flashing a new node, set it up in the console: <code>set name &lt;name&gt;</code>,
<code>password &lt;admin password&gt;</code> (at most 15 characters), your own region with
<code>region put cz-&lt;kraj&gt; cz</code> + <code>region save</code>. A repeater forwards from its
first boot (upstream default) and these builds are on the live CZ frequency:
on a desk without its antenna, <code>set repeat off</code> until it is in place.</p>
<h2 id="experimental-firmware-update-pushed-by-the-admin-ota">Experimental: firmware update pushed by the admin (<code>*-ota</code>)</h2>
<p>Every nRF52 build with a text console (repeater, observer, room server,
sensor) is in the release once more as an <strong>experimental</strong> <code>*-ota</code> /
<code>*-observer-ota</code> image. It takes a new firmware from its admin with the
<code>fw …</code> commands: on the USB or BLE console, or <strong>over the mesh as remote admin
CLI</strong>. No bootloader change, no second bank: the node stores the package in
free flash, checks all of it (signature, hashes, the delta applied dry) and
rewrites itself only on <code>fw apply</code>, from a routine running in RAM. A power
cut during the rewrite leaves it in the bootloader, back via USB/BLE DFU.</p>
<ul>
<li>Each <code>*-ota</code> image comes with a full package
<code>&lt;board&gt;_&lt;role&gt;-ota-&lt;release&gt;.mcfw</code> (USB/BLE only) and a delta
<code>….from-&lt;earlier release&gt;.mcfw</code> from every kept earlier release, typically
a few kB.</li>
<li><strong>Over the mesh a node takes only a delta, and never an older version than
it runs</strong> -- enforced by the node, not by the tool. A full image or a step
back only locally (<code>fw apply downgrade</code>). <code>fw apply</code> wants the battery at
3.8 V or more unless the node runs on USB.</li>
<li>Packages and <code>SHA256SUMS</code> are signed by <code>meshcore-ota@tth-pub</code>, and an
<code>*-ota</code> image accepts no other signature. Checking the downloads:
<code>ssh-keygen -Y verify -f tools/ota_allowed_signers -I meshcore-ota@tth-pub
-n meshcore-ota -s SHA256SUMS.sig &lt; SHA256SUMS</code>. Your own build with your own
key: <code>[ota] pubkey</code> in <code>platformio.local.ini</code>.</li>
<li>The first <code>*-ota</code> image is flashed the usual way (above), later ones go as
deltas. Tools: <code>tools/ota_push.py</code> (USB), <code>tools/ota_mesh_push.py</code> (over the
mesh through a companion; needs the <code>meshcore</code> Python library, takes the
admin password from <code>[secrets] admin_pw</code> in <code>platformio.local.ini</code>; <code>--side</code>
carries the transfer on a side channel, off the shared mesh),
<code>tools/ota_pack.py info</code>. The transfer itself is the OTA engine of the
<a href="https://git.rfa.cz/tth-pub/meshcore-ansible">tth.meshcore</a> Ansible
collection (module <code>meshcore_fw_ota</code>), one code for the tools and Ansible.
From a phone: the <a href="https://git.rfa.cz/tth-pub/meshcore-open">meshcore-open</a>
fork, repeater management → Firmware update (OTA), which finds the delta in
the release by itself. How it works and bench numbers:
<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/ota.md">docs/ota.md</a>.</li>
<li><strong>Experimental even within this fork</strong>: the images come with every
release (see the warning above) and have no second bank and no automatic
rollback. A bad firmware that boots keeps running until you push the next
one; one that does not boot needs USB/BLE DFU in hand. Tried on the bench
(XIAO, USB, mesh, side channel) and on two of our masts since 13. 11. 2026.
The radio watchdogs (see Diagnostics and operations) catch an image that
boots with a dead radio: switch <code>set radio.silence</code> on for nodes you push
to. Costs ~10 kB of RAM.</li>
</ul>
<h2 id="build">Build</h2>
<ul>
<li>Version stamping in every nRF52 env (<code>v1.18.0-tth&lt;sha&gt;</code>, <code>+</code> = dirty tree),
base version from the upstream tag (<code>tools/build_version.py</code>).</li>
<li><code>tools/</code>: host tools for the nodes -- consoles (USB, BLE), flashing, bench
tests, diagnostics (<a href="https://git.rfa.cz/tth-pub/meshcore-tth/src/branch/main/tools/README.md">tools/README.md</a>). Board names come
from a local config outside the repo (<code>tools/config.example.ini</code>).</li>
<li><code>hardware/cavity-box</code>: parametric enclosure for a cavity filter on a mast.</li>
</ul>
<hr />
<p><em>Níže je README upstreamového MeshCore. Jeho flasher, klienti a návody se
týkají oficiálního firmwaru, ne releasů tohoto forku. / Below is upstream
MeshCore's README: its flasher, clients and guides refer to the official
firmware, not to this fork's releases.</em></p>
</section>
</main>
</div>
<hr><footer>
<div class="terminal-mkdocs-footer-grid">
<div id="terminal-mkdocs-footer-copyright-info">
Site built with <a href="http://www.mkdocs.org">MkDocs</a> and <a href="https://github.com/ntno/mkdocs-terminal">Terminal for MkDocs</a>.
</div>
</div>
</footer>
</div>
<div class="modal" id="mkdocs_search_modal" tabindex="-1" role="alertdialog" aria-modal="true" aria-labelledby="searchModalLabel">
<div class="modal-dialog modal-lg" role="search">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="searchModalLabel">Search</h5>
<button type="button" class="close btn btn-default btn-ghost" data-dismiss="modal" aria-label="Close">x</button>
</div>
<div class="modal-body">
<p id="searchInputLabel">Type to start searching</p>
<form>
<div class="form-group">
<input type="search" class="form-control" aria-labelledby="searchInputLabel" placeholder="" id="mkdocs-search-query" title="Please enter search terms here">
</div>
</form>
<div id="mkdocs-search-results" data-no-results-text="No document matches found"></div>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</body>
</html>
-4435
View File
File diff suppressed because it is too large. Load diff
-1
View File
@@ -1 +0,0 @@
{"version":3,"file":"bootstrap.js","sources":["../../js/src/util.js","../../js/src/alert.js","../../js/src/button.js","../../js/src/carousel.js","../../js/src/collapse.js","../../js/src/dropdown.js","../../js/src/modal.js","../../js/src/tools/sanitizer.js","../../js/src/tooltip.js","../../js/src/popover.js","../../js/src/scrollspy.js","../../js/src/tab.js","../../js/src/toast.js","../../js/src/index.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): util.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport $ from 'jquery'\n\n/**\n * ------------------------------------------------------------------------\n * Private TransitionEnd Helpers\n * ------------------------------------------------------------------------\n */\n\nconst TRANSITION_END = 'transitionend'\nconst MAX_UID = 1000000\nconst MILLISECONDS_MULTIPLIER = 1000\n\n// Shoutout AngusCroll (https://goo.gl/pxwQGp)\nfunction toType(obj) {\n return {}.toString.call(obj).match(/\\s([a-z]+)/i)[1].toLowerCase()\n}\n\nfunction getSpecialTransitionEndEvent() {\n return {\n bindType: TRANSITION_END,\n delegateType: TRANSITION_END,\n handle(event) {\n if ($(event.target).is(this)) {\n return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params\n }\n return undefined // eslint-disable-line no-undefined\n }\n }\n}\n\nfunction transitionEndEmulator(duration) {\n let called = false\n\n $(this).one(Util.TRANSITION_END, () => {\n called = true\n })\n\n setTimeout(() => {\n if (!called) {\n Util.triggerTransitionEnd(this)\n }\n }, duration)\n\n return this\n}\n\nfunction setTransitionEndSupport() {\n $.fn.emulateTransitionEnd = transitionEndEmulator\n $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent()\n}\n\n/**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\nconst Util = {\n\n TRANSITION_END: 'bsTransitionEnd',\n\n getUID(prefix) {\n do {\n // eslint-disable-next-line no-bitwise\n prefix += ~~(Math.random() * MAX_UID) // \"~~\" acts like a faster Math.floor() here\n } while (document.getElementById(prefix))\n return prefix\n },\n\n getSelectorFromElement(element) {\n let selector = element.getAttribute('data-target')\n\n if (!selector || selector === '#') {\n const hrefAttr = element.getAttribute('href')\n selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''\n }\n\n try {\n return document.querySelector(selector) ? selector : null\n } catch (err) {\n return null\n }\n },\n\n getTransitionDurationFromElement(element) {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let transitionDuration = $(element).css('transition-duration')\n let transitionDelay = $(element).css('transition-delay')\n\n const floatTransitionDuration = parseFloat(transitionDuration)\n const floatTransitionDelay = parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n },\n\n reflow(element) {\n return element.offsetHeight\n },\n\n triggerTransitionEnd(element) {\n $(element).trigger(TRANSITION_END)\n },\n\n // TODO: Remove in v5\n supportsTransitionEnd() {\n return Boolean(TRANSITION_END)\n },\n\n isElement(obj) {\n return (obj[0] || obj).nodeType\n },\n\n typeCheckConfig(componentName, config, configTypes) {\n for (const property in configTypes) {\n if (Object.prototype.hasOwnProperty.call(configTypes, property)) {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = value && Util.isElement(value)\n ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new Error(\n `${componentName.toUpperCase()}: ` +\n `Option \"${property}\" provided type \"${valueType}\" ` +\n `but expected type \"${expectedTypes}\".`)\n }\n }\n }\n },\n\n findShadowRoot(element) {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root insLine truncated
-7
View File
@@ -1,7 +0,0 @@
/*!
* Bootstrap v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("jquery"),require("popper.js")):"function"==typeof define&&define.amd?define(["exports","jquery","popper.js"],e):e((t=t||self).bootstrap={},t.jQuery,t.Popper)}(this,function(t,g,u){"use strict";function i(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e,n){return e&&i(t.prototype,e),n&&i(t,n),t}function l(o){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},e=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.forEach(function(t){var e,n,i;e=o,i=r[n=t],n in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i})}return o}g=g&&g.hasOwnProperty("default")?g.default:g,u=u&&u.hasOwnProperty("default")?u.default:u;var e="transitionend";function n(t){var e=this,n=!1;return g(this).one(_.TRANSITION_END,function(){n=!0}),setTimeout(function(){n||_.triggerTransitionEnd(e)},t),this}var _={TRANSITION_END:"bsTransitionEnd",getUID:function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},getSelectorFromElement:function(t){var e=t.getAttribute("data-target");if(!e||"#"===e){var n=t.getAttribute("href");e=n&&"#"!==n?n.trim():""}try{return document.querySelector(e)?e:null}catch(t){return null}},getTransitionDurationFromElement:function(t){if(!t)return 0;var e=g(t).css("transition-duration"),n=g(t).css("transition-delay"),i=parseFloat(e),o=parseFloat(n);return i||o?(e=e.split(",")[0],n=n.split(",")[0],1e3*(parseFloat(e)+parseFloat(n))):0},reflow:function(t){return t.offsetHeight},triggerTransitionEnd:function(t){g(t).trigger(e)},supportsTransitionEnd:function(){return Boolean(e)},isElement:function(t){return(t[0]||t).nodeType},typeCheckConfig:function(t,e,n){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var o=n[i],r=e[i],s=r&&_.isElement(r)?"element":(a=r,{}.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase());if(!new RegExp(o).test(s))throw new Error(t.toUpperCase()+': Option "'+i+'" provided type "'+s+'" but expected type "'+o+'".')}var a},findShadowRoot:function(t){if(!document.documentElement.attachShadow)return null;if("function"!=typeof t.getRootNode)return t instanceof ShadowRoot?t:t.parentNode?_.findShadowRoot(t.parentNode):null;var e=t.getRootNode();return e instanceof ShadowRoot?e:null}};g.fn.emulateTransitionEnd=n,g.event.special[_.TRANSITION_END]={bindType:e,delegateType:e,handle:function(t){if(g(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}};var o="alert",r="bs.alert",a="."+r,c=g.fn[o],h={CLOSE:"close"+a,CLOSED:"closed"+a,CLICK_DATA_API:"click"+a+".data-api"},f="alert",d="fade",m="show",p=function(){function i(t){this._element=t}var t=i.prototype;return t.close=function(t){var e=this._element;t&&(e=this._getRootElement(t)),this._triggerCloseEvent(e).isDefaultPrevented()||this._removeElement(e)},t.dispose=function(){g.removeData(this._element,r),this._element=null},t._getRootElement=function(t){var e=_.getSelectorFromElement(t),n=!1;return e&&(n=document.querySelector(e)),n||(n=g(t).closest("."+f)[0]),n},t._triggerCloseEvent=function(t){var e=g.Event(h.CLOSE);return g(t).trigger(e),e},t._removeElement=function(e){var n=this;if(g(e).removeClass(m),g(e).hasClass(d)){var t=_.getTransitionDurationFromElement(e);g(e).one(_.TRANSITION_END,function(t){return n._destroyElement(e,t)}).emulateTransitionEnd(t)}else this._destroyElement(e)},t._destroyElement=function(t){g(t).detach().trigger(h.CLOSED).remove()},i._jQueryInterface=function(n){return this.each(function(){var t=g(this),e=t.data(r);e||(e=new i(this),t.data(r,e)),"close"===n&&e[n](this)})},i._handleDismiss=function(e){return function(t){t&&t.preventDefault(),e.close(this)}},s(i,null,[{key:"VERSION",get:function(){return"4.3.1"}}]),i}();g(document).on(h.CLICK_DATA_API,'[data-dismiss="alert"]',p._handleDismiss(new p)),g.fn[o]=p._jQueryInterface,g.fn[o].Constructor=p,g.fn[o].noConflict=function(){return g.fn[o]=c,p._jQueryInterface};var v="button",y="bs.button",E="."+y,C=".data-api",T=g.fn[v],S="active",b="btn",I="focus",D='[data-toggle^="button"]',w='[data-toggle="buttons"]',A='input:not([type="hidden"])',N=".active",O=".btn",k={CLICK_DATA_API:"click"+E+C,FOCUS_BLUR_DATA_API:"focus"+E+C+" blur"+E+C},P=function(){function n(t){this._element=t}var t=n.prototype;return t.toggle=function(){var t=!0,e=!0,n=g(this._element).closest(w)[0];if(n){var i=this._element.querySelector(A);if(i){if("radio"===i.type)if(i.checked&&this._element.classList.contains(S))t=!1;else{var o=n.querySelector(N);o&&g(o).removeClass(S)}if(t){if(i.hasAttribute("disabled")||n.hasAttribute("disabled")||i.classList.contains("disabled")||n.classList.contains("disabled"))return;i.checked=!this._element.classList.contains(S),g(i).trigger("chLine truncated
//# sourceMappingURL=bootstrap.min.js.map
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["../../js/src/util.js","../../js/src/alert.js","../../js/src/button.js","../../js/src/carousel.js","../../js/src/collapse.js","../../js/src/dropdown.js","../../js/src/modal.js","../../js/src/tools/sanitizer.js","../../js/src/tooltip.js","../../js/src/popover.js","../../js/src/scrollspy.js","../../js/src/tab.js","../../js/src/toast.js","../../js/src/index.js"],"names":["TRANSITION_END","transitionEndEmulator","duration","_this","this","called","$","one","Util","setTimeout","triggerTransitionEnd","getUID","prefix","Math","random","document","getElementById","getSelectorFromElement","element","selector","getAttribute","hrefAttr","trim","querySelector","err","getTransitionDurationFromElement","transitionDuration","css","transitionDelay","floatTransitionDuration","parseFloat","floatTransitionDelay","split","reflow","offsetHeight","trigger","supportsTransitionEnd","Boolean","isElement","obj","nodeType","typeCheckConfig","componentName","config","configTypes","property","Object","prototype","hasOwnProperty","call","expectedTypes","value","valueType","toString","match","toLowerCase","RegExp","test","Error","toUpperCase","findShadowRoot","documentElement","attachShadow","getRootNode","ShadowRoot","parentNode","root","fn","emulateTransitionEnd","event","special","bindType","delegateType","handle","target","is","handleObj","handler","apply","arguments","NAME","DATA_KEY","EVENT_KEY","JQUERY_NO_CONFLICT","Event","CLOSE","CLOSED","CLICK_DATA_API","ClassName","Alert","_element","close","rootElement","_getRootElement","_triggerCloseEvent","isDefaultPrevented","_removeElement","dispose","removeData","parent","closest","closeEvent","removeClass","hasClass","_destroyElement","detach","remove","_jQueryInterface","each","$element","data","_handleDismiss","alertInstance","preventDefault","on","Constructor","noConflict","DATA_API_KEY","Selector","FOCUS_BLUR_DATA_API","Button","toggle","triggerChangeEvent","addAriaPressed","input","type","checked","classList","contains","activeElement","hasAttribute","focus","setAttribute","toggleClass","button","Default","interval","keyboard","slide","pause","wrap","touch","DefaultType","Direction","SLIDE","SLID","KEYDOWN","MOUSEENTER","MOUSELEAVE","TOUCHSTART","TOUCHMOVE","TOUCHEND","POINTERDOWN","POINTERUP","DRAG_START","LOAD_DATA_API","PointerType","TOUCH","PEN","Carousel","_items","_interval","_activeElement","_isPaused","_isSliding","touchTimeout","touchStartX","touchDeltaX","_config","_getConfig","_indicatorsElement","_touchSupported","navigator","maxTouchPoints","_pointerEvent","window","PointerEvent","MSPointerEvent","_addEventListeners","next","_slide","nextWhenVisible","hidden","prev","cycle","clearInterval","setInterval","visibilityState","bind","to","index","activeIndex","_getItemIndex","length","direction","off","_objectSpread","_handleSwipe","absDeltax","abs","_this2","_keydown","_addTouchEventListeners","_this3","start","originalEvent","pointerType","clientX","touches","end","clearTimeout","querySelectorAll","e","add","tagName","which","slice","indexOf","_getItemByDirection","isNextDirection","isPrevDirection","lastItemIndex","itemIndex","_triggerSlideEvent","relatedTarget","eventDirectionName","targetIndex","fromIndex","slideEvent","from","_setActiveIndicatorElement","indicators","nextIndicator","children","addClass","directionalClassName","orderClassName","_this4","activeElementIndex","nextElement","nextElementIndex","isCycling","slidEvent","nextElementInterval","parseInt","defaultInterval","action","TypeError","ride","_dataApiClickHandler","slideIndex","carousels","i","len","$carousel","SHOW","SHOWN","HIDE","HIDDEN","Dimension","Collapse","_isTransitioning","_triggerArray","id","toggleList","elem","filterElement","filter","foundElem","_selector","push","_parent","_getParent","_addAriaAndCollapsedClass","hide","show","actives","activesData","not","startEvent","dimension","_getDimension","style","attr","setTransitioning","scrollSize","getBoundingClientRect","triggerArrayLength","isTransitioning","jquery","_getTargetFromElement","triggerArray","isOpen","$this","currentTarget","$trigger","selectors","$target","REGEXP_KEYDOWN","ARROW_UP_KEYCODE","CLICK","KEYDOWN_DATA_API","KEYUP_DATA_API","AttachmentMap","offset","flip","boundary","reference","display","Dropdown","_popper","_menu","_getMenuElement","_inNavbar","_detectNavbar","disabled","_getParentFromElement","isActive","_clearMenus","showEvent","Popper","referenceElement","_getPopperConfig","body","noop","hideEvent","destroy","update","scheduleUpdate","stopPropagation","constructor","_getPlacement","$parentDropdown","placement","_getOffset","offsets","popperConfig","modifiers","enabled","preventOverflow","boundariesElement","applyStyle","toggles","context","clickEvent","dropdownMenu","_dataApiKeydownHandler","items","backdrop","FOCUSIN","RESIZE","CLICK_DISMISS","KEYDOWN_DISMISS","MOUSEUP_DISMISS","MOUSEDOWN_DISMISS","Modal","_dialog","_backdrop","_isShown","_isBodyOverflowing","_ignoreBackdropClick","_scrolLine truncated
-1
View File
@@ -1 +0,0 @@
(function(window,undefined){var readyList,rootjQuery,core_strundefined=typeof undefined,location=window.location,document=window.document,docElem=document.documentElement,_jQuery=window.jQuery,_$=window.$,class2type={},core_deletedIds=[],core_version="1.10.1",core_concat=core_deletedIds.concat,core_push=core_deletedIds.push,core_slice=core_deletedIds.slice,core_indexOf=core_deletedIds.indexOf,core_toString=class2type.toString,core_hasOwn=class2type.hasOwnProperty,core_trim=core_version.trim,jQuery=function(selector,context){return new jQuery.fn.init(selector,context,rootjQuery)},core_pnum=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,core_rnotwhite=/\S+/g,rtrim=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,rquickExpr=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,rsingleTag=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,rvalidchars=/^[\],:{}\s]*$/,rvalidbraces=/(?:^|:|,)(?:\s*\[)+/g,rvalidescape=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,rvalidtokens=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,rmsPrefix=/^-ms-/,rdashAlpha=/-([\da-z])/gi,fcamelCase=function(all,letter){return letter.toUpperCase()},completed=function(event){if(document.addEventListener||event.type==="load"||document.readyState==="complete"){detach();jQuery.ready()}},detach=function(){if(document.addEventListener){document.removeEventListener("DOMContentLoaded",completed,false);window.removeEventListener("load",completed,false)}else{document.detachEvent("onreadystatechange",completed);window.detachEvent("onload",completed)}};jQuery.fn=jQuery.prototype={jquery:core_version,constructor:jQuery,init:function(selector,context,rootjQuery){var match,elem;if(!selector){return this}if(typeof selector==="string"){if(selector.charAt(0)==="<"&&selector.charAt(selector.length-1)===">"&&selector.length>=3){match=[null,selector,null]}else{match=rquickExpr.exec(selector)}if(match&&(match[1]||!context)){if(match[1]){context=context instanceof jQuery?context[0]:context;jQuery.merge(this,jQuery.parseHTML(match[1],context&&context.nodeType?context.ownerDocument||context:document,true));if(rsingleTag.test(match[1])&&jQuery.isPlainObject(context)){for(match in context){if(jQuery.isFunction(this[match])){this[match](context[match])}else{this.attr(match,context[match])}}}return this}else{elem=document.getElementById(match[2]);if(elem&&elem.parentNode){if(elem.id!==match[2]){return rootjQuery.find(selector)}this.length=1;this[0]=elem}this.context=document;this.selector=selector;return this}}else if(!context||context.jquery){return(context||rootjQuery).find(selector)}else{return this.constructor(context).find(selector)}}else if(selector.nodeType){this.context=this[0]=selector;this.length=1;return this}else if(jQuery.isFunction(selector)){return rootjQuery.ready(selector)}if(selector.selector!==undefined){this.selector=selector.selector;this.context=selector.context}return jQuery.makeArray(selector,this)},selector:"",length:0,toArray:function(){return core_slice.call(this)},get:function(num){return num==null?this.toArray():num<0?this[this.length+num]:this[num]},pushStack:function(elems){var ret=jQuery.merge(this.constructor(),elems);ret.prevObject=this;ret.context=this.context;return ret},each:function(callback,args){return jQuery.each(this,callback,args)},ready:function(fn){jQuery.ready.promise().done(fn);return this},slice:function(){return this.pushStack(core_slice.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(i){var len=this.length,j=+i+(i<0?len:0);return this.pushStack(j>=0&&j<len?[this[j]]:[])},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem)}))},end:function(){return this.prevObject||this.constructor(null)},push:core_push,sort:[].sort,splice:[].splice};jQuery.fn.init.prototype=jQuery.fn;jQuery.extend=jQuery.fn.extend=function(){var src,copyIsArray,copy,name,options,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[1]||{};i=2}if(typeof target!=="object"&&!jQuery.isFunction(target)){target={}}if(length===i){target=this;--i}for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){src=target[name];copy=options[name];if(target===copy){continue}if(deep&&copy&&(jQuery.isPlainObject(copy)||(copyIsArray=jQuery.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&jQuery.isArray(src)?src:[]}else{clone=src&&jQuery.isPlainObject(src)?src:{}}target[name]=jQuery.extend(deep,clone,copy)}else if(copy!==undefined){target[name]=copy}}}}return target};jQuery.extend({expando:"jQuery"+(core_version+Math.random()).replace(/\D/g,""),noConflict:function(deep){if(window.$===jQuery){window.$=_$}if(deep&&window.jQuery===jQuery){window.jQuery=_jQuery}return jQuery},isReady:false,readyWait:1,holdReady:function(hold){if(hold){jQuery.readyWait++}else{jQuery.ready(true)}},ready:function(wait){if(wait===true?--jQuery.readyWait:jQuery.isReady){return}if(!document.body){return setTimeout(jQueryLine truncated
-1
View File
@@ -1 +0,0 @@
{"version":3,"sources":["jquery-1.10.1/jquery-1.10.1.js"],"names":["window","undefined","readyList","rootjQuery","core_strundefined","location","document","docElem","documentElement","_jQuery","jQuery","_$","$","class2type","core_deletedIds","core_version","core_concat","concat","core_push","push","core_slice","slice","core_indexOf","indexOf","core_toString","toString","core_hasOwn","hasOwnProperty","core_trim","trim","selector","context","fn","init","core_pnum","source","core_rnotwhite","rtrim","rquickExpr","rsingleTag","rvalidchars","rvalidbraces","rvalidescape","rvalidtokens","rmsPrefix","rdashAlpha","fcamelCase","all","letter","toUpperCase","completed","event","addEventListener","type","readyState","detach","ready","removeEventListener","detachEvent","prototype","jquery","constructor","match","elem","this","charAt","length","exec","merge","parseHTML","nodeType","ownerDocument","test","isPlainObject","isFunction","attr","getElementById","parentNode","id","find","makeArray","toArray","call","get","num","pushStack","elems","ret","prevObject","each","callback","args","promise","done","apply","arguments","first","eq","last","i","len","j","map","end","sort","splice","extend","src","copyIsArray","copy","name","options","clone","target","deep","isArray","expando","Math","random","replace","noConflict","isReady","readyWait","holdReady","hold","wait","body","setTimeout","resolveWith","trigger","off","obj","Array","isWindow","isNumeric","isNaN","parseFloat","isFinite","String","key","e","support","ownLast","isEmptyObject","error","msg","Error","data","keepScripts","parsed","scripts","createElement","buildFragment","remove","childNodes","parseJSON","JSON","parse","Function","parseXML","xml","tmp","DOMParser","parseFromString","ActiveXObject","async","loadXML","getElementsByTagName","noop","globalEval","execScript","camelCase","string","nodeName","toLowerCase","value","isArraylike","text","arr","results","Object","inArray","max","second","l","grep","inv","retVal","arg","guid","proxy","access","chainable","emptyGet","raw","bulk","now","Date","getTime","swap","old","style","Deferred","attachEvent","top","frameElement","doScroll","doScrollCheck","split","cachedruns","Expr","getText","isXML","compile","outermostContext","sortInput","setDocument","documentIsHTML","rbuggyQSA","rbuggyMatches","matches","contains","preferredDoc","dirruns","classCache","createCache","tokenCache","compilerCache","hasDuplicate","sortOrder","strundefined","MAX_NEGATIVE","hasOwn","pop","push_native","booleans","whitespace","characterEncoding","identifier","attributes","pseudos","RegExp","rcomma","rcombinators","rsibling","rattributeQuotes","rpseudo","ridentifier","matchExpr","ID","CLASS","TAG","ATTR","PSEUDO","CHILD","bool","needsContext","rnative","rinputs","rheader","rescape","runescape","funescape","_","escaped","escapedWhitespace","high","fromCharCode","els","Sizzle","seed","m","groups","nid","newContext","newSelector","getElementsByClassName","qsa","tokenize","getAttribute","setAttribute","toSelector","join","querySelectorAll","qsaError","removeAttribute","select","isNative","keys","cache","cacheLength","shift","markFunction","assert","div","removeChild","addHandle","attrs","handler","current","setHandle","attrHandle","boolHandler","val","getAttributeNode","specified","interpolationHandler","valueHandler","defaultValue","siblingCheck","a","b","cur","diff","sourceIndex","nextSibling","createInputPseudo","createButtonPseudo","createPositionalPseudo","argument","matchIndexes","node","doc","parent","parentWindow","innerHTML","firstChild","className","input","appendChild","createComment","getById","getElementsByName","filter","attrId","tag","matchesSelector","webkitMatchesSelector","mozMatchesSelector","oMatchesSelector","msMatchesSelector","disconnectedMatch","compareDocumentPosition","adown","bup","sortDetached","div1","compare","aup","ap","bp","unshift","expr","elements","uniqueSort","duplicates","detectDuplicates","sortStable","textContent","nodeValue","selectors","createPseudo","relative",">","dir"," ","+","~","preFilter","excess","unquoted","nodeNameSelector","pattern","operator","check","result","what","simple","forward","ofType","outerCache","nodeIndex","start","useCache","lastChild","pseudo","setFilters","idx","matched","not","matcher","unmatched","has","innerText","lang","elemLang","hash","root","focus","activeElement","hasFocus","href","tabIndex","enabled","disabled","checked","selected","selectedIndex","empty","header","button","even","odd","lt","gt","radio","checkbox","file","password","image","submit","reset","parseOnly","tokens","soFar","preFilters","cached","addCombinator","combinator","base","checkNonElements","doneName","dirkey","elementMatcher","matchers","condense","newUnmatched","mapped","setMatcher","postFilter","postFinder","postSelector","temp","preMap","postMap","preexisting","multipleContexts","matcherIn","matcherOut","matcherFromTokens","checkContext","leadingRelative","implicitRelative","matchContext","matchAnyContexLine truncated
-26
View File
@@ -1,26 +0,0 @@
Copyright © 2014-present, Tom Christie. All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the following
conditions are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Loaded 100 of 387 files, more files were not shown because too many files have changed in this diff. Show more