From ffc07b81d99d1dfed126a43d4d77fe9cec18257b Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Wed, 26 May 2021 11:24:37 +0200 Subject: [PATCH 1/5] Trigger reduced to two points --- sa_core.c | 12 ++++++++++++ si4432.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/sa_core.c b/sa_core.c index c8e08fd..a24d8bf 100644 --- a/sa_core.c +++ b/sa_core.c @@ -3483,6 +3483,7 @@ again: // Spur redu // shell_printf("%d %.3f %.3f %.1f\r\n", i, local_IF/1000000.0, lf/1000000.0, subRSSI); // ************** trigger mode if need +#if 0 // trigger on measure 4 point #define T_POINTS 4 #define T_LEVEL_UNDEF (1<<(16-T_POINTS)) // should drop after 4 shifts left @@ -3492,6 +3493,17 @@ again: // Spur redu #define T_DOWN_MASK (0b0011) // 2 from up 2 to bottom #define T_UP_MASK (0b1100) // 2 from bottom 2 to up #define T_LEVEL_CLEAN ~(1< Date: Wed, 26 May 2021 15:49:30 +0200 Subject: [PATCH 2/5] Default switch offset and spur quick menu repaired --- main.c | 5 +++++ ui_sa.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 5ee8256..6f54a3f 100644 --- a/main.c +++ b/main.c @@ -2139,6 +2139,7 @@ int main(void) #ifdef TINYSA3 has_esd = ((palReadPort(GPIOB) & (1<<12)) ? false : true ); + #endif @@ -2202,6 +2203,10 @@ int main(void) #endif /* restore config */ +#ifdef TINYSA3 + if (has_esd) + config.switch_offset = -5.0; +#endif config_recall(); config.cor_am = 0; // Should be removed from config config.cor_nfm = 0; diff --git a/ui_sa.c b/ui_sa.c index 8ec0ccc..7c0ff97 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -3371,7 +3371,7 @@ redraw_cal_status: if (setting.spur_removal != S_OFF) { ili9341_set_foreground(setting.spur_removal == S_ON ? LCD_BRIGHT_COLOR_GREEN : LCD_FG_COLOR); lcd_printf(x, y, "Spur:\n%s", S_IS_AUTO(setting.spur_removal) ? "AUTO" : "ON"); - y = add_quick_menu(y += YSTEP, (menuitem_t *)menu_stimulus); + y = add_quick_menu(y += YSTEP, (menuitem_t *)menu_config); } if (setting.mirror_masking) { ili9341_set_foreground(LCD_BRIGHT_COLOR_GREEN); From a647621233626bce571d06e03b0151de13fa3a76 Mon Sep 17 00:00:00 2001 From: DiSlord Date: Sun, 16 May 2021 16:32:20 +0300 Subject: [PATCH 3/5] Cleanup draw_cal_status code, use lcd_printf --- ui_sa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui_sa.c b/ui_sa.c index 7c0ff97..995da9b 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -3355,7 +3355,7 @@ redraw_cal_status: // if (setting.mode == M_LOW) { // Attenuation - ili9341_set_foreground(setting.auto_attenuation ? LCD_FG_COLOR : LCD_BRIGHT_COLOR_GREEN); + ili9341_set_foreground(setting.auto_attenuation ? LCD_BRIGHT_COLOR_GREEN : LCD_FG_COLOR); lcd_printf(x, y, "Atten:\n%4.2FdB", get_attenuation()); y = add_quick_menu(y+= YSTEP, (menuitem_t *)menu_atten); // } From 3abd42e62c4972c18661bef48f13b11dd9baf8eb Mon Sep 17 00:00:00 2001 From: DiSlord Date: Sun, 23 May 2021 18:56:03 +0300 Subject: [PATCH 4/5] Use defines in header for SD card buffers --- main.c | 4 ---- nanovna.h | 11 +++++++++++ ui.c | 13 ------------- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/main.c b/main.c index 6f54a3f..53c4df0 100644 --- a/main.c +++ b/main.c @@ -762,10 +762,6 @@ void send_buffer(uint8_t * buf, int s) #ifndef __USE_SD_CARD__ #error "Need enable SD card support __USE_SD_CARD__ in nanovna.h, for use ENABLE_SD_CARD_CMD" #endif -// Fat file system work area (at the end of spi_buffer) -static FATFS *fs_volume = (FATFS *)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS)); -// FatFS file object (at the end of spi_buffer) -static FIL *fs_file = ( FIL*)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS) - sizeof(FIL)); static FRESULT cmd_sd_card_mount(void){ const FRESULT res = f_mount(fs_volume, "", 1); diff --git a/nanovna.h b/nanovna.h index d9384a4..d182f17 100644 --- a/nanovna.h +++ b/nanovna.h @@ -1322,6 +1322,17 @@ void rtc_set_time(uint32_t dr, uint32_t tr); #include "../FatFs/ff.h" #include "../FatFs/diskio.h" bool SD_Inserted(void); +// Buffers for SD card use spi_buffer +#if SPI_BUFFER_SIZE < 2048 +#error "SPI_BUFFER_SIZE for SD card support need size >= 2048" +#else +// Fat file system work area (at the end of spi_buffer) +#define fs_volume (FATFS *)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS)) +// FatFS file object (at the end of spi_buffer) +#define fs_file ( FIL*)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS) - sizeof(FIL)) +// Filename object (at the end of spi_buffer) +#define fs_filename ( char*)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS) - sizeof(FIL) - FF_LFN_BUF - 4) +#endif void testLog(void); // debug log #endif diff --git a/ui.c b/ui.c index 92f2b81..1a71816 100644 --- a/ui.c +++ b/ui.c @@ -71,19 +71,6 @@ volatile uint8_t operation_requested = OP_NONE; int8_t previous_marker = MARKER_INVALID; -#ifdef __USE_SD_CARD__ -#if SPI_BUFFER_SIZE < 2048 -#error "SPI_BUFFER_SIZE for SD card support need size >= 2048" -#else -// Fat file system work area (at the end of spi_buffer) -static FATFS *fs_volume = (FATFS *)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS)); -// FatFS file object (at the end of spi_buffer) -static FIL *fs_file = ( FIL*)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS) - sizeof(FIL)); -// Filename object (at the end of spi_buffer) -static char *fs_filename = ( char*)(((uint8_t*)(&spi_buffer[SPI_BUFFER_SIZE])) - sizeof(FATFS) - sizeof(FIL) - FF_LFN_BUF - 4); -#endif -#endif - enum { UI_NORMAL, UI_MENU, UI_KEYPAD }; From e4deb9f04e3a739bf8b0a30b8d32df9e683fbbde Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Wed, 26 May 2021 15:53:53 +0200 Subject: [PATCH 5/5] Revert "Cleanup draw_cal_status code, use lcd_printf" This reverts commit a647621233626bce571d06e03b0151de13fa3a76. --- ui_sa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui_sa.c b/ui_sa.c index 995da9b..7c0ff97 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -3355,7 +3355,7 @@ redraw_cal_status: // if (setting.mode == M_LOW) { // Attenuation - ili9341_set_foreground(setting.auto_attenuation ? LCD_BRIGHT_COLOR_GREEN : LCD_FG_COLOR); + ili9341_set_foreground(setting.auto_attenuation ? LCD_FG_COLOR : LCD_BRIGHT_COLOR_GREEN); lcd_printf(x, y, "Atten:\n%4.2FdB", get_attenuation()); y = add_quick_menu(y+= YSTEP, (menuitem_t *)menu_atten); // }