mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
Add LCD command for debug (disabled as default)
Add defines for more easy change to 48kHz ADC Add commented touch calibration settings for 4`LCD
This commit is contained in:
parent
3d927881af
commit
bed63ca84b
23
main.c
23
main.c
|
|
@ -69,6 +69,7 @@ static volatile vna_shellcmd_t shell_function = 0;
|
|||
#define ENABLE_COLOR_COMMAND
|
||||
// Enable I2C command for send data to AIC3204, used for debug
|
||||
//#define ENABLE_I2C_COMMAND
|
||||
//#define ENABLE_LCD_COMMAND
|
||||
|
||||
static void apply_CH0_error_term_at(int i);
|
||||
static void apply_CH1_error_term_at(int i);
|
||||
|
|
@ -716,7 +717,7 @@ config_t config = {
|
|||
.trace_color = { DEFAULT_TRACE_1_COLOR, DEFAULT_TRACE_2_COLOR, DEFAULT_TRACE_3_COLOR, DEFAULT_TRACE_4_COLOR },
|
||||
// .touch_cal = { 693, 605, 124, 171 }, // 2.4 inch LCD panel
|
||||
.touch_cal = { 338, 522, 153, 192 }, // 2.8 inch LCD panel
|
||||
// .touch_cal = { 252, 450, 111, 150 }, //4.0" LCD
|
||||
// .touch_cal = { 272, 521, 114, 153 }, //4.0" LCD
|
||||
.harmonic_freq_threshold = FREQUENCY_THRESHOLD,
|
||||
.vbat_offset = 500,
|
||||
.bandwidth = BANDWIDTH_1000
|
||||
|
|
@ -2233,6 +2234,18 @@ VNA_SHELL_FUNCTION(cmd_i2c){
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_LCD_COMMAND
|
||||
VNA_SHELL_FUNCTION(cmd_lcd){
|
||||
uint8_t d[VNA_SHELL_MAX_ARGUMENTS];
|
||||
if (argc == 0) return;
|
||||
for (int i=0;i<argc;i++)
|
||||
d[i] = my_atoui(argv[i]);
|
||||
uint32_t ret = lcd_send_command(d[0], argc-1, &d[1]);
|
||||
shell_printf("ret = 0x%08X\r\n", ret);
|
||||
chThdSleepMilliseconds(5);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_THREADS_COMMAND
|
||||
#if CH_CFG_USE_REGISTRY == FALSE
|
||||
#error "Threads Requite enabled CH_CFG_USE_REGISTRY in chconf.h"
|
||||
|
|
@ -2331,6 +2344,9 @@ static const VNAShellCommand commands[] =
|
|||
#ifdef ENABLE_I2C_COMMAND
|
||||
{"i2c" , cmd_i2c , CMD_WAIT_MUTEX},
|
||||
#endif
|
||||
#ifdef ENABLE_LCD_COMMAND
|
||||
{"lcd" , cmd_lcd , CMD_WAIT_MUTEX},
|
||||
#endif
|
||||
#ifdef ENABLE_THREADS_COMMAND
|
||||
{"threads" , cmd_threads , 0},
|
||||
#endif
|
||||
|
|
@ -2402,6 +2418,11 @@ static void VNAShell_executeLine(char *line)
|
|||
// Parse and execute line
|
||||
char *lp = line, *ep;
|
||||
shell_nargs = 0;
|
||||
#if 0 // debug console log
|
||||
ili9341_fill(0, FREQUENCIES_YPOS, LCD_WIDTH, FONT_GET_HEIGHT, DEFAULT_BG_COLOR);
|
||||
ili9341_drawstring(lp, FREQUENCIES_XPOS1, FREQUENCIES_YPOS);
|
||||
osalThreadSleepMilliseconds(1000);
|
||||
#endif
|
||||
while (*lp != 0) {
|
||||
// Skipping white space and tabs at string begin.
|
||||
while (*lp == ' ' || *lp == '\t') lp++;
|
||||
|
|
|
|||
10
nanovna.h
10
nanovna.h
|
|
@ -38,6 +38,8 @@
|
|||
#define FREQUENCY_THRESHOLD 300000100U
|
||||
// Frequency offset (sin_cos table in dsp.c generated for 6k, 8k, 10k, if change need create new table )
|
||||
#define FREQUENCY_OFFSET 8000
|
||||
//For 48kHz
|
||||
//#define FREQUENCY_OFFSET 5000
|
||||
// Use real time build table (undef for use constant)
|
||||
//#define USE_VARIABLE_OFFSET
|
||||
// Speed of light const
|
||||
|
|
@ -140,12 +142,20 @@ extern const char *info_about[];
|
|||
// Bandwidth depend from AUDIO_SAMPLES_COUNT and audio ADC frequency
|
||||
// for AUDIO_SAMPLES_COUNT = 48 and ADC = 96kHz one measure give 96000/48=2000Hz
|
||||
// define additional measure count
|
||||
#if AUDIO_ADC_FREQ/AUDIO_SAMPLES_COUNT == 2000
|
||||
#define BANDWIDTH_2000 ( 1 - 1)
|
||||
#define BANDWIDTH_1000 ( 2 - 1)
|
||||
#define BANDWIDTH_333 ( 6 - 1)
|
||||
#define BANDWIDTH_100 ( 20 - 1)
|
||||
#define BANDWIDTH_30 ( 66 - 1)
|
||||
#define BANDWIDTH_10 (200 - 1)
|
||||
#elif AUDIO_ADC_FREQ/AUDIO_SAMPLES_COUNT == 1000
|
||||
#define BANDWIDTH_1000 ( 1 - 1)
|
||||
#define BANDWIDTH_333 ( 3 - 1)
|
||||
#define BANDWIDTH_100 ( 10 - 1)
|
||||
#define BANDWIDTH_30 ( 33 - 1)
|
||||
#define BANDWIDTH_10 (100 - 1)
|
||||
#endif
|
||||
|
||||
#ifdef ENABLED_DUMP
|
||||
extern int16_t ref_buf[];
|
||||
|
|
|
|||
6
ui.c
6
ui.c
|
|
@ -43,8 +43,8 @@ uistat_t uistat = {
|
|||
|
||||
#define BUTTON_DOWN_LONG_TICKS 5000 /* 500ms */
|
||||
#define BUTTON_DOUBLE_TICKS 2500 /* 250ms */
|
||||
#define BUTTON_REPEAT_TICKS 200 /* 20ms */
|
||||
#define BUTTON_DEBOUNCE_TICKS 400 /* 40ms */
|
||||
#define BUTTON_REPEAT_TICKS 100 /* 10ms */
|
||||
#define BUTTON_DEBOUNCE_TICKS 400 /* 40ms */
|
||||
|
||||
/* lever switch assignment */
|
||||
#define BIT_UP1 3
|
||||
|
|
@ -1136,7 +1136,9 @@ const menuitem_t menu_transform[] = {
|
|||
};
|
||||
|
||||
const menuitem_t menu_bandwidth[] = {
|
||||
#ifdef BANDWIDTH_2000
|
||||
{ MT_ADV_CALLBACK, BANDWIDTH_2000, "2 kHz", menu_bandwidth_acb },
|
||||
#endif
|
||||
{ MT_ADV_CALLBACK, BANDWIDTH_1000, "1 kHz", menu_bandwidth_acb },
|
||||
{ MT_ADV_CALLBACK, BANDWIDTH_333, "333 Hz", menu_bandwidth_acb },
|
||||
{ MT_ADV_CALLBACK, BANDWIDTH_100, "100 Hz", menu_bandwidth_acb },
|
||||
|
|
|
|||
Loading…
Reference in a new issue