Skip to content

Configuration Commands

Commands for device configuration and persistent settings.

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.

config <option> [0|1]

The available options depend on compile-time feature flags:

OptionCompile FlagDescription
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
ch> config auto 1
ch> config flip 1
ch> config separator 0
ch> config grid 1
ch> config dot 0
ch> config tif 1
  • Each option maps to a bit in config._vna_mode via apply_VNA_mode()
  • The option index is position-dependent — changing compile flags shifts the indices
  • Use saveconfig to persist changes across power cycles

Save configuration to flash memory.

saveconfig

The config_t structure containing:

  • Touch calibration data
  • VBat offset
  • Serial port settings
  • Display orientation
  • Color palette
  • UI mode flags
  • RTC calibration (if enabled)
ch> config flip 1
ch> saveconfig

Reset configuration to defaults.

clearconfig
  • Erases configuration area in flash
  • Resets device
ch> clearconfig
(device resets)

Set or get TCXO reference frequency.

tcxo [frequency_Hz]
ParameterDescriptionDefault
frequency_HzReference oscillator frequency26000000
ch> tcxo
26000000
ch> tcxo 26001234

Adjust if measurements are consistently offset in frequency:

  1. Measure a known-good signal or frequency reference
  2. Calculate correction: new_tcxo = old_tcxo * (actual_freq / displayed_freq)
  3. Set new value and verify
  • Typical TCXO accuracy is +/- 2.5 ppm
  • Small corrections (hundreds of Hz) are normal
  • Save with saveconfig after adjusting

Set harmonic frequency threshold.

threshold [frequency_Hz]
ParameterDescription
frequency_HzFrequency above which harmonics are used
MixerDefault Threshold
SA612A290000110 Hz
ZeeTK NE602A300000110 Hz
ch> threshold
300000110
ch> threshold 295000000

Adjust if seeing measurement artifacts near the threshold frequency.


Read battery voltage.

vbat
ch> vbat
3850 mV
  • Returns voltage in millivolts
  • Affected by vbat_offset correction
  • Typical Li-ion range: 3000-4200 mV

Set battery voltage reading offset (requires ENABLE_VBAT_OFFSET_COMMAND).

vbat_offset [offset_mV]
ParameterDescription
offset_mVCorrection in millivolts
ch> vbat_offset
0
ch> vbat_offset -50
  1. Connect known voltage source or measure with multimeter
  2. Read current display: vbat
  3. Calculate offset: offset = actual_mV - displayed_mV
  4. Set offset: vbat_offset <offset>
  5. Save: saveconfig

Set display colors (requires ENABLE_COLOR_COMMAND).

color [index] [rgb_value]
IndexNameDefault
0BG_COLOR0x0000 (Black)
1FG_COLOR0xFFFF (White)
2GRID_COLOR0x4208
3MENU_COLOR0xF7BE
4MENU_TEXT_COLOR0x0000
5MENU_ACTIVE_COLOR0xFFFF
6TRACE_1_COLOR0xFFE0 (Yellow)
7TRACE_2_COLOR0x07FF (Cyan)
8TRACE_3_COLOR0x07E0 (Green)
9TRACE_4_COLOR0xF81F (Magenta)
10TRACE_5_COLOR0xF800 (Red)
11TRACE_6_COLOR0x001F (Blue)
12NORMAL_BAT_COLOR0x07E0 (Green)
13LOW_BAT_COLOR0xF800 (Red)

Colors are 16-bit RGB565:

  • Bits 15-11: Red (5 bits)
  • Bits 10-5: Green (6 bits)
  • Bits 4-0: Blue (5 bits)
ch> color 6
65504
ch> color 6 0xF800
ch> color 7 0x07FF

Serial console configuration (requires ENABLE_USART_COMMAND).

usart [usb|serial]
ValueDescription
usbUSB CDC console
serialUSART1 console
usart_cfg [baudrate]
Baud RateValue
96009600
1920019200
3840038400
5760057600
115200115200
230400230400
460800460800
921600921600
ch> usart_cfg
115200
ch> usart_cfg 921600
ch> usart serial

RTC date/time operations (requires __USE_RTC__).

time [YYMMDD] [HHMMSS]
ParameterFormatDescription
YYMMDDYYMMDDDate (BCD format)
HHMMSSHHMMSSTime (BCD format)
ch> time
2024-01-15 14:30:45
ch> time 240115 143045
time cal [ppm]

Adjust RTC drift in parts per million.


Calibrate touch screen.

touchcal
  1. Touch the upper-left calibration point
  2. Touch the lower-right calibration point
  3. Calibration values are stored
ch> touchcal
touch upper left
touch lower right
done
ch> saveconfig

Test touch screen response.

touchtest

Displays touch coordinates continuously. Press push button to exit.

ch> touchtest
100 150
102 148
...
(press push button to exit)

Configuration commands in main.c:

CommandHandlerLineCompile Flag
configcmd_config547ENABLE_CONFIG_COMMAND
saveconfigcmd_saveconfig713(always)
clearconfigcmd_clearconfig721(always)
tcxocmd_tcxo1462(always)
thresholdcmd_threshold701(always)
vbatcmd_vbat2568(always)
vbat_offsetcmd_vbat_offset2576ENABLE_VBAT_OFFSET_COMMAND
colorcmd_color2641ENABLE_COLOR_COMMAND
usartcmd_usart2747ENABLE_USART_COMMAND
usart_cfgcmd_usart_cfg2735ENABLE_USART_COMMAND
timecmd_time653__USE_RTC__
touchcalcmd_touchcal2335(always)
touchtestcmd_touchtest2347(always)