Configuration Commands
Commands for device configuration and persistent settings.
config
Section titled “config”Get or set various configuration flags (requires ENABLE_CONFIG_COMMAND). Each option is a boolean toggle controlled by the _vna_mode bitfield in the config structure.
Syntax
Section titled “Syntax”config <option> [0|1]Options
Section titled “Options”The available options depend on compile-time feature flags:
| Option | Compile Flag | Description |
|---|---|---|
auto | (always) | Automatic parameter selection (e.g., power, bandwidth) |
avg | __USE_SMOOTH__ | Enable trace averaging/smoothing |
connection | __USE_SERIAL_CONSOLE__ | Serial console connection mode |
mode | (always) | Band selection mode |
grid | (always) | Show grid values on display |
dot | (always) | Dot-style trace rendering (vs. connected lines) |
bk | __USE_BACKUP__ | Backup mode |
flip | __FLIP_DISPLAY__ | Flip display 180 degrees |
separator | __DIGIT_SEPARATOR__ | Decimal separator style (0=. 1=,) |
tif | __SD_CARD_DUMP_TIFF__ | Save screenshots as TIFF instead of BMP |
Examples
Section titled “Examples”ch> config auto 1ch> config flip 1ch> config separator 0ch> config grid 1ch> config dot 0ch> config tif 1- Each option maps to a bit in
config._vna_modeviaapply_VNA_mode() - The option index is position-dependent — changing compile flags shifts the indices
- Use
saveconfigto persist changes across power cycles
saveconfig
Section titled “saveconfig”Save configuration to flash memory.
Syntax
Section titled “Syntax”saveconfigWhat Gets Saved
Section titled “What Gets Saved”The config_t structure containing:
- Touch calibration data
- VBat offset
- Serial port settings
- Display orientation
- Color palette
- UI mode flags
- RTC calibration (if enabled)
Example
Section titled “Example”ch> config flip 1ch> saveconfigclearconfig
Section titled “clearconfig”Reset configuration to defaults.
Syntax
Section titled “Syntax”clearconfigBehavior
Section titled “Behavior”- Erases configuration area in flash
- Resets device
Example
Section titled “Example”ch> clearconfig(device resets)Set or get TCXO reference frequency.
Syntax
Section titled “Syntax”tcxo [frequency_Hz]Parameters
Section titled “Parameters”| Parameter | Description | Default |
|---|---|---|
frequency_Hz | Reference oscillator frequency | 26000000 |
Examples
Section titled “Examples”ch> tcxo26000000
ch> tcxo 26001234Adjust if measurements are consistently offset in frequency:
- Measure a known-good signal or frequency reference
- Calculate correction:
new_tcxo = old_tcxo * (actual_freq / displayed_freq) - Set new value and verify
- Typical TCXO accuracy is +/- 2.5 ppm
- Small corrections (hundreds of Hz) are normal
- Save with
saveconfigafter adjusting
threshold
Section titled “threshold”Set harmonic frequency threshold.
Syntax
Section titled “Syntax”threshold [frequency_Hz]Parameters
Section titled “Parameters”| Parameter | Description |
|---|---|
frequency_Hz | Frequency above which harmonics are used |
Default Values
Section titled “Default Values”| Mixer | Default Threshold |
|---|---|
| SA612A | 290000110 Hz |
| ZeeTK NE602A | 300000110 Hz |
Examples
Section titled “Examples”ch> threshold300000110
ch> threshold 295000000Adjust if seeing measurement artifacts near the threshold frequency.
Read battery voltage.
Syntax
Section titled “Syntax”vbatOutput
Section titled “Output”ch> vbat3850 mV- Returns voltage in millivolts
- Affected by
vbat_offsetcorrection - Typical Li-ion range: 3000-4200 mV
vbat_offset
Section titled “vbat_offset”Set battery voltage reading offset (requires ENABLE_VBAT_OFFSET_COMMAND).
Syntax
Section titled “Syntax”vbat_offset [offset_mV]Parameters
Section titled “Parameters”| Parameter | Description |
|---|---|
offset_mV | Correction in millivolts |
Examples
Section titled “Examples”ch> vbat_offset0
ch> vbat_offset -50Calibration Procedure
Section titled “Calibration Procedure”- Connect known voltage source or measure with multimeter
- Read current display:
vbat - Calculate offset:
offset = actual_mV - displayed_mV - Set offset:
vbat_offset <offset> - Save:
saveconfig
Set display colors (requires ENABLE_COLOR_COMMAND).
Syntax
Section titled “Syntax”color [index] [rgb_value]Color Indices
Section titled “Color Indices”| Index | Name | Default |
|---|---|---|
| 0 | BG_COLOR | 0x0000 (Black) |
| 1 | FG_COLOR | 0xFFFF (White) |
| 2 | GRID_COLOR | 0x4208 |
| 3 | MENU_COLOR | 0xF7BE |
| 4 | MENU_TEXT_COLOR | 0x0000 |
| 5 | MENU_ACTIVE_COLOR | 0xFFFF |
| 6 | TRACE_1_COLOR | 0xFFE0 (Yellow) |
| 7 | TRACE_2_COLOR | 0x07FF (Cyan) |
| 8 | TRACE_3_COLOR | 0x07E0 (Green) |
| 9 | TRACE_4_COLOR | 0xF81F (Magenta) |
| 10 | TRACE_5_COLOR | 0xF800 (Red) |
| 11 | TRACE_6_COLOR | 0x001F (Blue) |
| 12 | NORMAL_BAT_COLOR | 0x07E0 (Green) |
| 13 | LOW_BAT_COLOR | 0xF800 (Red) |
RGB565 Format
Section titled “RGB565 Format”Colors are 16-bit RGB565:
- Bits 15-11: Red (5 bits)
- Bits 10-5: Green (6 bits)
- Bits 4-0: Blue (5 bits)
Examples
Section titled “Examples”ch> color 665504
ch> color 6 0xF800ch> color 7 0x07FFusart / usart_cfg
Section titled “usart / usart_cfg”Serial console configuration (requires ENABLE_USART_COMMAND).
usart - Select Console
Section titled “usart - Select Console”usart [usb|serial]| Value | Description |
|---|---|
usb | USB CDC console |
serial | USART1 console |
usart_cfg - Set Baud Rate
Section titled “usart_cfg - Set Baud Rate”usart_cfg [baudrate]| Baud Rate | Value |
|---|---|
| 9600 | 9600 |
| 19200 | 19200 |
| 38400 | 38400 |
| 57600 | 57600 |
| 115200 | 115200 |
| 230400 | 230400 |
| 460800 | 460800 |
| 921600 | 921600 |
Examples
Section titled “Examples”ch> usart_cfg115200
ch> usart_cfg 921600ch> usart serialRTC date/time operations (requires __USE_RTC__).
Syntax
Section titled “Syntax”time [YYMMDD] [HHMMSS]Parameters
Section titled “Parameters”| Parameter | Format | Description |
|---|---|---|
YYMMDD | YYMMDD | Date (BCD format) |
HHMMSS | HHMMSS | Time (BCD format) |
Examples
Section titled “Examples”ch> time2024-01-15 14:30:45
ch> time 240115 143045RTC Calibration
Section titled “RTC Calibration”time cal [ppm]Adjust RTC drift in parts per million.
touchcal
Section titled “touchcal”Calibrate touch screen.
Syntax
Section titled “Syntax”touchcalProcedure
Section titled “Procedure”- Touch the upper-left calibration point
- Touch the lower-right calibration point
- Calibration values are stored
Example
Section titled “Example”ch> touchcaltouch upper lefttouch lower rightdonech> saveconfigtouchtest
Section titled “touchtest”Test touch screen response.
Syntax
Section titled “Syntax”touchtestBehavior
Section titled “Behavior”Displays touch coordinates continuously. Press push button to exit.
Example
Section titled “Example”ch> touchtest100 150102 148...(press push button to exit)Source Code Reference
Section titled “Source Code Reference”Configuration commands in main.c:
| Command | Handler | Line | Compile Flag |
|---|---|---|---|
config | cmd_config | 547 | ENABLE_CONFIG_COMMAND |
saveconfig | cmd_saveconfig | 713 | (always) |
clearconfig | cmd_clearconfig | 721 | (always) |
tcxo | cmd_tcxo | 1462 | (always) |
threshold | cmd_threshold | 701 | (always) |
vbat | cmd_vbat | 2568 | (always) |
vbat_offset | cmd_vbat_offset | 2576 | ENABLE_VBAT_OFFSET_COMMAND |
color | cmd_color | 2641 | ENABLE_COLOR_COMMAND |
usart | cmd_usart | 2747 | ENABLE_USART_COMMAND |
usart_cfg | cmd_usart_cfg | 2735 | ENABLE_USART_COMMAND |
time | cmd_time | 653 | __USE_RTC__ |
touchcal | cmd_touchcal | 2335 | (always) |
touchtest | cmd_touchtest | 2347 | (always) |