Allowing for microReticulum to pair with two Raspberry Pi Zero 2Ws

This commit is contained in:
John Poole 2026-05-21 17:36:53 -07:00
commit b0b5e4f8cb
2 changed files with 219 additions and 0 deletions

View file

@ -84,6 +84,10 @@ Host-native environment:
jp_native
jp_native_peripheral
jp_native_dual
pi_zero_1_native
pi_zero_1_peripheral
pi_zero_2_native
pi_zero_2_peripheral
```
`jp_native` builds a Linux console program instead of ESP32 firmware. It uses the host Bluetooth adapter through BlueZ D-Bus, skips the OLED path, and prints received text to stdout. The current jp payload is `texts/little_boy_blue.txt`.
@ -255,6 +259,63 @@ exercises/306_microReticulum_ble_file_transfer_oled/.pio/build/jp_native/program
The Pi must have BlueZ, GLib/GIO development headers, and a BLE adapter that supports LE central mode. If the Pi is running a 32-bit OS, the result is a 32-bit ARM binary, not ARM64.
### Two Pi Zero 2Ws
For two Pi Zero 2Ws, build one peripheral/server binary and one central/client binary. These environments use distinct node labels and text payloads:
```text
pi_zero_1_peripheral Node-PIZERO1-PERIPHERAL little_boy_blue.txt
pi_zero_2_native Node-PIZERO2-CLIENT children.txt
```
Build on a Pi with the same OS architecture and compatible libraries as the target Pi Zero 2Ws:
```bash
source /home/jlpoole/rnsenv/bin/activate
cd /usr/local/src/microreticulum/microReticulumTbeam
pio run -d exercises/306_microReticulum_ble_file_transfer_oled -e pi_zero_1_peripheral -e pi_zero_2_native
```
The output binaries are:
```text
exercises/306_microReticulum_ble_file_transfer_oled/.pio/build/pi_zero_1_peripheral/program
exercises/306_microReticulum_ble_file_transfer_oled/.pio/build/pi_zero_2_native/program
```
You can copy those binaries to another Pi Zero 2W and rename them for clarity if both Pis use the same CPU architecture, OS bitness, and compatible runtime libraries. Check with:
```bash
file exercises/306_microReticulum_ble_file_transfer_oled/.pio/build/pi_zero_1_peripheral/program
ldd exercises/306_microReticulum_ble_file_transfer_oled/.pio/build/pi_zero_1_peripheral/program
```
If one Pi is 32-bit and the other is 64-bit, or their GLib/BlueZ runtime libraries differ significantly, build directly on each target instead of copying binaries.
Run peripheral first on the first Pi:
```bash
./pi_zero_1_peripheral
```
Wait for:
```text
BLE linux-peripheral: advertising Reticulum service; waiting for central
```
Then run central on the second Pi:
```bash
./pi_zero_2_native
```
The reverse role binaries are also available if you want to swap which Pi advertises:
```bash
pio run -d exercises/306_microReticulum_ble_file_transfer_oled -e pi_zero_2_peripheral -e pi_zero_1_native
```
## Expected Output
Once the Link is active, both nodes start sending:

View file

@ -215,6 +215,164 @@ lib_deps =
microReticulum=symlink:///usr/local/src/microreticulum/microReticulum
lib_compat_mode = off
[env:pi_zero_1_native]
platform = native
build_type = debug
extra_scripts = pre:scripts/embed_text.py
custom_text_source = texts/little_boy_blue.txt
build_unflags =
-std=gnu++11
build_flags =
-std=c++17
-g3
-ggdb
-Wall
-Wextra
-Wno-missing-field-initializers
-Wno-format
-Wno-unused-parameter
-include stdint.h
-D HOST_NATIVE
-D NATIVE
-D RNS_USE_FS
-D RNS_PERSIST_PATHS
-D USTORE_USE_UNIVERSALFS
-D MSGPACK_USE_BOOST=OFF
-D FILE_TRANSFER_CHUNK_SIZE=32
-D FILE_TRANSFER_CHUNK_INTERVAL_MS=500
-D HOST_NODE_LABEL=\"Node-PIZERO1-CLIENT\"
!pkg-config --cflags gio-2.0 glib-2.0 bluez
!pkg-config --libs gio-2.0 glib-2.0 bluez
build_src_filter =
+<host_jp_main.cpp>
+<HostBluezBleInterface.cpp>
lib_deps =
ArduinoJson@^7.4.2
MsgPack@^0.4.2
https://github.com/attermann/Crypto.git
https://github.com/attermann/microStore.git
microReticulum=symlink:///usr/local/src/microreticulum/microReticulum
lib_compat_mode = off
[env:pi_zero_1_peripheral]
platform = native
build_type = debug
extra_scripts = pre:scripts/embed_text.py
custom_text_source = texts/little_boy_blue.txt
build_unflags =
-std=gnu++11
build_flags =
-std=c++17
-g3
-ggdb
-Wall
-Wextra
-Wno-missing-field-initializers
-Wno-format
-Wno-unused-parameter
-include stdint.h
-D HOST_NATIVE
-D HOST_BLE_PERIPHERAL
-D NATIVE
-D RNS_USE_FS
-D RNS_PERSIST_PATHS
-D USTORE_USE_UNIVERSALFS
-D MSGPACK_USE_BOOST=OFF
-D FILE_TRANSFER_CHUNK_SIZE=32
-D FILE_TRANSFER_CHUNK_INTERVAL_MS=500
-D HOST_NODE_LABEL=\"Node-PIZERO1-PERIPHERAL\"
!pkg-config --cflags gio-2.0 glib-2.0 bluez
!pkg-config --libs gio-2.0 glib-2.0 bluez
build_src_filter =
+<host_jp_main.cpp>
+<HostBluezPeripheralInterface.cpp>
lib_deps =
ArduinoJson@^7.4.2
MsgPack@^0.4.2
https://github.com/attermann/Crypto.git
https://github.com/attermann/microStore.git
microReticulum=symlink:///usr/local/src/microreticulum/microReticulum
lib_compat_mode = off
[env:pi_zero_2_native]
platform = native
build_type = debug
extra_scripts = pre:scripts/embed_text.py
custom_text_source = texts/children.txt
build_unflags =
-std=gnu++11
build_flags =
-std=c++17
-g3
-ggdb
-Wall
-Wextra
-Wno-missing-field-initializers
-Wno-format
-Wno-unused-parameter
-include stdint.h
-D HOST_NATIVE
-D NATIVE
-D RNS_USE_FS
-D RNS_PERSIST_PATHS
-D USTORE_USE_UNIVERSALFS
-D MSGPACK_USE_BOOST=OFF
-D FILE_TRANSFER_CHUNK_SIZE=32
-D FILE_TRANSFER_CHUNK_INTERVAL_MS=500
-D HOST_NODE_LABEL=\"Node-PIZERO2-CLIENT\"
!pkg-config --cflags gio-2.0 glib-2.0 bluez
!pkg-config --libs gio-2.0 glib-2.0 bluez
build_src_filter =
+<host_jp_main.cpp>
+<HostBluezBleInterface.cpp>
lib_deps =
ArduinoJson@^7.4.2
MsgPack@^0.4.2
https://github.com/attermann/Crypto.git
https://github.com/attermann/microStore.git
microReticulum=symlink:///usr/local/src/microreticulum/microReticulum
lib_compat_mode = off
[env:pi_zero_2_peripheral]
platform = native
build_type = debug
extra_scripts = pre:scripts/embed_text.py
custom_text_source = texts/children.txt
build_unflags =
-std=gnu++11
build_flags =
-std=c++17
-g3
-ggdb
-Wall
-Wextra
-Wno-missing-field-initializers
-Wno-format
-Wno-unused-parameter
-include stdint.h
-D HOST_NATIVE
-D HOST_BLE_PERIPHERAL
-D NATIVE
-D RNS_USE_FS
-D RNS_PERSIST_PATHS
-D USTORE_USE_UNIVERSALFS
-D MSGPACK_USE_BOOST=OFF
-D FILE_TRANSFER_CHUNK_SIZE=32
-D FILE_TRANSFER_CHUNK_INTERVAL_MS=500
-D HOST_NODE_LABEL=\"Node-PIZERO2-PERIPHERAL\"
!pkg-config --cflags gio-2.0 glib-2.0 bluez
!pkg-config --libs gio-2.0 glib-2.0 bluez
build_src_filter =
+<host_jp_main.cpp>
+<HostBluezPeripheralInterface.cpp>
lib_deps =
ArduinoJson@^7.4.2
MsgPack@^0.4.2
https://github.com/attermann/Crypto.git
https://github.com/attermann/microStore.git
microReticulum=symlink:///usr/local/src/microreticulum/microReticulum
lib_compat_mode = off
[env:amy]
extends = tbeam_base
upload_port = /dev/ttytAMY