diff --git a/main.c b/main.c index ecd22da..008b692 100644 --- a/main.c +++ b/main.c @@ -1518,13 +1518,13 @@ VNA_SHELL_FUNCTION(cmd_test) #define VERSION "unknown" #endif -const char NANOVNA_VERSION[] = VERSION; +const char TINYSA_VERSION[] = VERSION; VNA_SHELL_FUNCTION(cmd_version) { (void)argc; (void)argv; - shell_printf("%s\r\n", NANOVNA_VERSION); + shell_printf("%s\r\n", TINYSA_VERSION); } VNA_SHELL_FUNCTION(cmd_vbat) diff --git a/nanovna.h b/nanovna.h index 4a7f447..a1b0728 100644 --- a/nanovna.h +++ b/nanovna.h @@ -18,7 +18,7 @@ */ #include "ch.h" -#ifdef TINYSA_F303 +//#ifdef TINYSA_F303 #include "adc_F303.h" #ifdef TINYSA_F072 #error "Remove comment for #ifdef TINYSA_F303" @@ -27,7 +27,7 @@ #define TINYSA4 #endif #define TINYSA4_PROTO -#endif +//#endif #ifdef TINYSA_F072 #ifdef TINYSA_F303 @@ -163,6 +163,8 @@ typedef float measurement_t[TRACES_MAX][POINTS_COUNT]; extern measurement_t measured; #endif +extern const char TINYSA_VERSION[]; + #ifdef __REMOTE_DESKTOP__ extern uint8_t auto_capture; extern int16_t mouse_x; diff --git a/sa_core.c b/sa_core.c index bf10f1b..3f53df5 100644 --- a/sa_core.c +++ b/sa_core.c @@ -3123,7 +3123,7 @@ again: // Spur redu else { #ifdef TINYSA4 - local_IF = local_IF - DEFAULT_SPUR_OFFSET/4; // No spure removal and no spur, center in IF but avoid mirror + local_IF = local_IF - 800000 + actual_rbw_x10*100; // No spure removal and no spur, center in IF but avoid mirror #else local_IF = local_IF; // + DEFAULT_SPUR_OFFSET/2; // No spure removal and no spur, center in IF #endif diff --git a/si4468.c b/si4468.c index 1a3436f..87873f5 100644 --- a/si4468.c +++ b/si4468.c @@ -275,13 +275,6 @@ void ADF4351_Setup(void) void ADF4351_WriteRegister32(int channel, const uint32_t value) { - uint32_t reg_n = value & 0x07; - if (reg_n && old_registers[reg_n] == value) return; // Always write register zero - // update cache - old_registers[reg_n] = value; - // For debug !! update stored value if enter from console - registers[reg_n] = value; - // Select chip CS_ADF_LOW(ADF4351_LE[channel]); // Send 32 bit register @@ -303,18 +296,25 @@ void ADF4351_WriteRegister32(int channel, const uint32_t value) void ADF4351_Set(int channel) { +#if 0 for (int i = 5; i >= 0; i--) { if (registers[i] != old_registers[i]) goto update; } return; update: +#endif set_SPI_mode(SPI_MODE_SI); if (SI4432_SPI_SPEED != ADF_SPI_SPEED) SPI_BR_SET(SI4432_SPI, ADF_SPI_SPEED); - for (int i = 5; i >= 0; i--) - ADF4351_WriteRegister32(channel, registers[i]); + for (int i = 5; i >= 0; i--) { +#if 0 + if (i == 0 || registers[i] != old_registers[i]) +#endif + ADF4351_WriteRegister32(channel, registers[i]); + old_registers[i] = registers[i]; + } if (SI4432_SPI_SPEED != ADF_SPI_SPEED) SPI_BR_SET(SI4432_SPI, SI4432_SPI_SPEED); } @@ -323,6 +323,8 @@ static freq_t prev_actual_freq = 0; void ADF4351_force_refresh(void) { prev_actual_freq = 0; + for (int i = 5; i >= 0; i--) + old_registers[i] = 0; } void ADF4351_modulo(int m) diff --git a/ui_sa.c b/ui_sa.c index ef34967..2a3496e 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -3504,9 +3504,15 @@ redraw_cal_status: // Version y += YSTEP + YSTEP/2 ; #ifdef TINYSA4 - strncpy(buf,&VERSION[9], BLEN-1); + strncpy(buf,&TINYSA_VERSION[9], BLEN+1); + if (buf[7]=='-') { + buf[3] = buf[4]; + buf[4] = buf[5]; + buf[5] = buf[6]; + } + buf[6] = 0; #else - strncpy(buf,&VERSION[8], BLEN-1); + strncpy(buf,&TINYSA_VERSION[8], BLEN-1); #endif ili9341_drawstring(buf, x, y);