Feature Flags
Complete reference for compile-time feature flags defined in nanovna.h.
Mixer Variant Selection
Section titled “Mixer Variant Selection”//#define __MS5351__ // Original MS5351 synthesizer#define __ZEETK__ // ZeeTK NE602A mixer (default)| Flag | Effect |
|---|---|
__ZEETK__ | ZeeTK NE602A mixer support, lower minimum frequency (600 Hz), threshold 300 MHz |
__MS5351__ | Original MS5351/SA612A, minimum 1600 Hz, threshold 290 MHz |
Display Configuration
Section titled “Display Configuration”LCD Driver Selection
Section titled “LCD Driver Selection”// F303 (NanoVNA-H4)#define LCD_DRIVER_ST7796S#define LCD_480x320
// F072 (NanoVNA-H) - auto-detect#define LCD_DRIVER_ILI9341#define LCD_DRIVER_ST7789#define LCD_320x240Display Features
Section titled “Display Features”| Flag | Description | Default |
|---|---|---|
__USE_DISPLAY_DMA__ | DMA mode for LCD writes | Enabled |
__LCD_BRIGHTNESS__ | Brightness control menu | F303 only |
__FLIP_DISPLAY__ | Allow 180-degree rotation | Enabled |
_USE_SHADOW_TEXT_ | Shadow on plot text | Enabled |
__VNA_FAST_LINES__ | Faster line drawing | Disabled |
Core Features
Section titled “Core Features”| Flag | Description | Default |
|---|---|---|
__DFU_SOFTWARE_MODE__ | Enter DFU from menu/command | Enabled |
__USE_RTC__ | Real-time clock support | Enabled |
__USE_BACKUP__ | RTC backup registers | Enabled |
__USE_SD_CARD__ | SD card file operations | Enabled |
__USB_UID__ | Unique USB serial string | Enabled |
__USE_SERIAL_CONSOLE__ | Serial port console | Enabled |
__USE_GRID_VALUES__ | Show Y-axis values | Enabled |
__REMOTE_DESKTOP__ | Remote control support | Enabled |
__USE_SMOOTH__ | Data smoothing option | Enabled |
__DIGIT_SEPARATOR__ | Configurable decimal separator | Enabled |
Math and DSP
Section titled “Math and DSP”| Flag | Description | Default |
|---|---|---|
__VNA_USE_MATH_TABLES__ | Precomputed sin/cos tables | Enabled |
__USE_VNA_MATH__ | Fast math approximations | Enabled |
USE_FFT_WINDOW_BUFFER | Cache FFT window function | Disabled |
__USE_DSP__ | Cortex-M4 DSP instructions | F303 only |
Math Table Details
Section titled “Math Table Details”When __VNA_USE_MATH_TABLES__ is enabled:
- 512-entry sin/cos table
- Maximum error: 4e-7
- Also used for FFT calculations
- Saves significant flash space
Measurement Module
Section titled “Measurement Module”#define __VNA_MEASURE_MODULE__ // Master enableWhen enabled, additional flags become available:
| Flag | Description |
|---|---|
__USE_LC_MATCHING__ | L/C matching calculator |
__S21_MEASURE__ | S21 component measurements |
__S11_CABLE_MEASURE__ | Cable length/loss (S11) |
__S11_RESONANCE_MEASURE__ | Resonance finder (S11) |
Measure Modes
Section titled “Measure Modes”enum { MEASURE_NONE = 0, MEASURE_LC_MATH, // LC matching network MEASURE_SHUNT_LC, // Shunt LC component MEASURE_SERIES_LC, // Series LC component MEASURE_SERIES_XTAL, // Crystal parameters MEASURE_FILTER, // Filter characterization MEASURE_S11_CABLE, // Cable length/loss MEASURE_S11_RESONANCE, // Resonance frequency MEASURE_END};SD Card Submodules
Section titled “SD Card Submodules”When __USE_SD_CARD__ is enabled:
| Flag | Description | Default |
|---|---|---|
__SD_CARD_LOAD__ | Load config.ini on boot | Enabled |
__SD_CARD_DUMP_TIFF__ | TIFF screenshot format | Enabled |
__SD_CARD_DUMP_FIRMWARE__ | Dump firmware to SD | Enabled |
__SD_FILE_BROWSER__ | File browser UI | Enabled |
Capture Formats
Section titled “Capture Formats”| Flag | Description |
|---|---|
__CAPTURE_RLE8__ | RLE8 compressed capture format |
Advanced Features
Section titled “Advanced Features”| Flag | Description | Default |
|---|---|---|
__VNA_Z_RENORMALIZATION__ | Port-Z renormalization | Disabled |
USE_VARIABLE_OFFSET | Runtime IF frequency table | Enabled |
USE_VARIABLE_OFFSET_MENU | IF selection menu | Enabled |
Debug Features
Section titled “Debug Features”These flags enable additional shell commands for debugging.
| Flag | Command | Description |
|---|---|---|
ENABLE_THREADS_COMMAND | threads | Thread information |
ENABLE_STAT_COMMAND | stat | System statistics |
ENABLE_GAIN_COMMAND | gain | Codec gain control |
ENABLE_TEST_COMMAND | test | Hardware tests |
ENABLE_I2C_COMMAND | i2c | I2C bus access |
ENABLE_LCD_COMMAND | lcd | LCD controller access |
ENABLE_SI5351_REG_WRITE | si | Si5351 register access |
ENABLE_BAND_COMMAND | band | Manual band override |
ENABLE_SAMPLE_COMMAND | sample | Raw sample values |
ENABLED_DUMP_COMMAND | dump | Raw ADC dump |
Hardware Constants
Section titled “Hardware Constants”Frequency Limits
Section titled “Frequency Limits”// Minimum frequency (depends on mixer)#ifdef __ZEETK__#define FREQUENCY_MIN 600 // 600 Hz#else#define FREQUENCY_MIN 1600 // 1600 Hz#endif
// Maximum frequency#define FREQUENCY_MAX 2000000000U // 2 GHz
// Harmonic threshold#ifdef __ZEETK__#define FREQUENCY_THRESHOLD 300000110U // 300 MHz#else#define FREQUENCY_THRESHOLD 290000110U // 290 MHz#endifSweep Points
Section titled “Sweep Points”// F303 target#define SWEEP_POINTS_MAX 401#define SWEEP_POINTS_MIN 21
// F072 target#define SWEEP_POINTS_MAX 101#define SWEEP_POINTS_MIN 21Audio Configuration
Section titled “Audio Configuration”#define AUDIO_ADC_FREQ_K 192 // ADC rate in kHz#define AUDIO_SAMPLES_COUNT 48 // Samples per measurement#define FREQUENCY_IF_K 12 // IF frequency in kHzTarget-Specific Defines
Section titled “Target-Specific Defines”Defined automatically for STM32F072:
#define ARM_MATH_CM0// No FPU// No __USE_DSP__Defined automatically for STM32F303:
#define NANOVNA_F303#define ARM_MATH_CM4#define __USE_DSP__// FPU available (hard float)Enabling Features
Section titled “Enabling Features”To enable a disabled feature:
- Open
nanovna.h - Uncomment or add the desired
#define - Rebuild firmware
Example:
// Enable Z renormalization#define __VNA_Z_RENORMALIZATION__
// Enable fast line drawing#define __VNA_FAST_LINES__Feature Dependencies
Section titled “Feature Dependencies”__USE_SD_CARD__├── __USE_RTC__ (required for timestamps)├── __SD_CARD_LOAD__├── __SD_CARD_DUMP_TIFF__├── __SD_CARD_DUMP_FIRMWARE__└── __SD_FILE_BROWSER__
__VNA_MEASURE_MODULE__├── __USE_LC_MATCHING__├── __S21_MEASURE__├── __S11_CABLE_MEASURE__└── __S11_RESONANCE_MEASURE__
USE_VARIABLE_OFFSET└── USE_VARIABLE_OFFSET_MENU
__LCD_BRIGHTNESS__└── __VNA_ENABLE_DAC__ (H4 uses DAC for brightness)Build-Time Defines
Section titled “Build-Time Defines”Set via Makefile UDEFS:
# F303 buildUDEFS = -DARM_MATH_CM4 -DVERSION=\"$(VERSION)\" -DNANOVNA_F303
# F072 buildUDEFS = -DARM_MATH_CM0 -DVERSION=\"$(VERSION)\"
# RTC source selectionUDEFS+= -DVNA_AUTO_SELECT_RTC_SOURCE# Or force LSE:# UDEFS+= -DVNA_USE_LSE