NVS Configuration
The firmware stores configuration in the ESP-IDF NVS (Non-Volatile Storage) flash partition under the lora_cfg namespace. Settings persist across reboots.
NVS namespace
Section titled “NVS namespace”Namespace: lora_cfg
LoRa radio settings
Section titled “LoRa radio settings”| Key | Type | Default | Description |
|---|---|---|---|
lora_addr | uint16 | 1 | Device LoRa address |
lora_dest | uint16 | 0 | Default destination (base station) address |
lora_net | uint8 | 0 | Network ID (0–16) |
lora_band | uint32 | 915000000 | Frequency in Hz |
lora_sf | uint8 | 9 | Spreading factor (7–12) |
Camera pipeline settings
Section titled “Camera pipeline settings”| Key | Type | Default | Description |
|---|---|---|---|
cam_period | uint32 | 0 | Periodic capture interval in ms (0 = disabled) |
cam_motion | uint8 | 0 | Motion detection enabled (0 or 1) |
cam_quality | uint8 | 12 | JPEG quality (0–63 for OV2640, lower = better) |
Default behavior
Section titled “Default behavior”If the lora_cfg namespace doesn’t exist or a key is missing, the firmware uses the hardcoded defaults from load_lora_config() in main.c. This happens on first boot or after an NVS erase.
Runtime updates
Section titled “Runtime updates”The C:CONFIG LoRa command updates in-memory settings but does not persist them to NVS. Settings revert to NVS values on reboot.
To persist changes, NVS must be written explicitly. Currently, NVS is read-only at startup — runtime persistence would require adding nvs_set_* calls to the config command handler.
Spreading factor trade-offs
Section titled “Spreading factor trade-offs”| SF | Range | Airtime | Throughput | Use case |
|---|---|---|---|---|
| 7 | Shortest | Fastest | Highest | Short range, fast transfers |
| 9 | Medium | Medium | Medium | Default — balanced |
| 12 | Longest | Slowest | Lowest | Maximum range, slow transfers |
Higher SF values increase range at the cost of much longer per-packet airtime, which directly impacts image transfer duration.
NVS partition layout
Section titled “NVS partition layout”NVS occupies 16KB in the partition table:
nvs, data, nvs, 0x9000, 0x4000 (16KB)This is sufficient for dozens of key-value pairs. The partition is separate from the OTA app partitions and survives firmware updates.