updated readme and deploy script

This commit is contained in:
shinya 2026-05-29 09:30:44 +02:00
parent d9b666e0f4
commit b86c441045
4 changed files with 107 additions and 20 deletions

View File

@ -2,15 +2,28 @@
Pi Zero W 2 captures frames, runs a motion shader, sends diffs over LoRa. Pi Zero W 2 captures frames, runs a motion shader, sends diffs over LoRa.
- `camera_example/` — libcamera + libjpeg-turbo, streams MJPEG over TCP. Works. - `camera_example/` — libcamera + libjpeg-turbo, streams MJPEG over TCP. Works.
- `shader_example/` — offscreen GL motion diff between two frames. Works on desktop. - `shader_example/` — offscreen GL motion diff between two frames. Works on desktop.
- `math_example/` — pixel → 3D vertex projection (depth map to OBJ mesh). - `math_example/` — pixel → 3D vertex projection (depth map to OBJ mesh).
- `chip_test_example/` — LR1121 LoRa + ICM-20948 IMU + u-blox GPS drivers/tests. - `chip_test_example/` — LR1121 LoRa + ICM-20948 IMU + u-blox GPS drivers/tests.
- `main.cpp` — prototype that wires camera + shader + TCP together. - `main.cpp` — prototype that wires camera + shader + TCP together.
References: ## Goal
- https://www.youtube.com/watch?v=zFiubdrJqqI
- https://github.com/ConsistentlyInconsistentYT/Pixeltovoxelprojector/ Automatic, real-time detection of fast high-flying objects (planes, drones) using
multiple Pi cameras and a GLES motion shader. Objects moving in straight lines or
smooth curves are kept; everything else is filtered out.
Each node scans the sky, detects motion, extracts a vertex line from the diff frame,
timestamps it via GPS, and transmits the minimal payload over LoRa.
The central device is also a Pi camera node running the same base pipeline, with
additional functionality for receiving LoRa packets from other nodes, fusing
sightlines, and saving combined results locally.
## Status
The examples are all individually working. Final integration (camera → shader → math →
LoRa) is the next step.
## Build main.cpp ## Build main.cpp
@ -20,3 +33,8 @@ g++ main.cpp -o main \
-levent -levent_pthreads -lpthread \ -levent -levent_pthreads -lpthread \
-lturbojpeg -lglfw -lGLEW -lGL -lEGL -lGLESv2 -lturbojpeg -lglfw -lGLEW -lGL -lEGL -lGLESv2
``` ```
## References
- https://www.youtube.com/watch?v=zFiubdrJqqI
- https://github.com/ConsistentlyInconsistentYT/Pixeltovoxelprojector/

View File

@ -61,7 +61,7 @@ make
Run verbose first so you see exactly where it fails: Run verbose first so you see exactly where it fails:
```sh ```sh
sudo ./lora_rx -v --433 sudo ./lora_rx -v
sudo ./imu_test -v sudo ./imu_test -v
./gps_test -v ./gps_test -v
``` ```
@ -71,8 +71,8 @@ sudo ./imu_test -v
## LoRa debug ## LoRa debug
```sh ```sh
ls /dev/spidev0.0 # SPI enabled? ls /dev/spidev0.0 # SPI enabled?
sudo ./lora_rx -v --433 # step labels show exactly which command hangs sudo ./lora_rx -v # step labels show exactly which command hangs
``` ```
If it hangs at `Calibrate` — the chip isn't responding over SPI at all. If it hangs at `Calibrate` — the chip isn't responding over SPI at all.
@ -81,13 +81,6 @@ Check wiring, CS, and that SPI is enabled. The crystal needs no tuning.
If TX/RX runs but packets never arrive — check that DIO5/DIO6 reach the RF If TX/RX runs but packets never arrive — check that DIO5/DIO6 reach the RF
switch on your module. Without the switch, the antenna path is disconnected. switch on your module. Without the switch, the antenna path is disconnected.
To try 2.4 GHz instead (different antenna required):
```sh
sudo ./lora_rx -v --24
sudo ./lora_tx -v --24
```
If the chip is stuck in bootloader (fw < 0x02xx), escape with: If the chip is stuck in bootloader (fw < 0x02xx), escape with:
```sh ```sh

View File

@ -39,10 +39,10 @@ deploy_and_build() {
return $BUILD_STATUS return $BUILD_STATUS
} }
deploy_and_build 10.91.51.166 & deploy_and_build 10.91.51.183 &
PID1=$! PID1=$!
deploy_and_build 10.91.51.165 & deploy_and_build 10.91.51.166 &
PID2=$! PID2=$!
wait $PID1 wait $PID1
@ -52,7 +52,7 @@ wait $PID2
STATUS2=$? STATUS2=$?
echo "----------------------------------------" echo "----------------------------------------"
echo "10.91.51.165 status: $STATUS1" echo "10.91.51.183 status: $STATUS1"
echo "10.91.51.166 status: $STATUS2" echo "10.91.51.166 status: $STATUS2"
if [ $STATUS1 -ne 0 ] || [ $STATUS2 -ne 0 ]; then if [ $STATUS1 -ne 0 ] || [ $STATUS2 -ne 0 ]; then

View File

@ -0,0 +1,76 @@
# lr1121_malnus.hpp — API reference
```cpp
#include "lr1121_malnus.hpp" // namespace lr1121
```
## Setup
```cpp
lr1121::Config cfg; // all fields have sensible defaults
cfg.freq_hz = lr1121::FREQ_433; // FREQ_433 / FREQ_868 / FREQ_2400
cfg.sf = 7; // spreading factor 612
cfg.bw = 0x04; // 0x03=62.5 kHz 0x04=125 kHz 0x05=250 kHz
cfg.cr = 0x01; // 0x01=4/5 0x02=4/6 0x03=4/7 0x04=4/8
cfg.tx_dbm = 10;
cfg.pa_sel = lr1121::PA_LP; // PA_LP (014 dBm) PA_HP (022 dBm)
lr1121::Radio radio;
if (!radio.begin(cfg))
fprintf(stderr, "init failed: %s\n", lr1121::Radio::errorString(radio.lastError()));
```
## TX / RX
```cpp
bool ok = radio.send(data, len); // blocks until TX_DONE or error
// returns: true=ok false=error (check lastError)
lr1121::RxInfo info;
// one-shot: arm, wait timeout_ms, chip returns to standby
int n = radio.receive(buf, sizeof(buf), 1000, &info);
// continuous: arm once, chip stays in RX between packets
radio.startListening();
for (;;) {
int n = radio.receive(buf, sizeof(buf), 0, &info); // 0 = wait forever per call
if (n > 0) { /* handle */ }
}
radio.stopListening(); // returns chip to standby
// receive() returns: n>=0 bytes -1=timeout/error -2=crc error
// info.rssi_dbm info.snr_db info.signal_rssi_dbm
```
## Runtime tuning *(call between packets, chip stays in standby)*
```cpp
radio.setFrequency(lr1121::FREQ_868);
radio.setTxPower(20, lr1121::PA_HP);
radio.setModulation(9, 0x04, 0x01); // sf, bw, cr
```
## Diagnostics
```cpp
lr1121::ChipVersion v = radio.chipVersion(); // v.hw v.type v.fw_hi v.fw_lo
float vbat = radio.vbatVolts();
uint16_t errs = radio.chipErrors(); // chip-side error flags
lr1121::Error e = radio.lastError();
const char *msg = lr1121::Radio::errorString(e);
```
## Errors
`Ok` `NotReady` `SpiOpen` `SpiIo` `GpioOpen` `BusyTimeout` `BadChip` `TxTimeout` `TxLbd` `RxTimeout` `RxCrc`
## Other
```cpp
radio.softResetSettings(); // re-apply Config without hard reset
radio.reboot(false); // reboot chip (true = stay in bootloader)
radio.end(); // close SPI + GPIO fds
const lr1121::Config &c = radio.config(); // current live config
```