Skip to content

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.

Namespace: lora_cfg

KeyTypeDefaultDescription
lora_addruint161Device LoRa address
lora_destuint160Default destination (base station) address
lora_netuint80Network ID (0–16)
lora_banduint32915000000Frequency in Hz
lora_sfuint89Spreading factor (7–12)
KeyTypeDefaultDescription
cam_perioduint320Periodic capture interval in ms (0 = disabled)
cam_motionuint80Motion detection enabled (0 or 1)
cam_qualityuint812JPEG quality (0–63 for OV2640, lower = better)

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.

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.

SFRangeAirtimeThroughputUse case
7ShortestFastestHighestShort range, fast transfers
9MediumMediumMediumDefault — balanced
12LongestSlowestLowestMaximum range, slow transfers

Higher SF values increase range at the cost of much longer per-packet airtime, which directly impacts image transfer duration.

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.