From 61cc1dc843f34af66ee0d78b1f859fd3a308789c Mon Sep 17 00:00:00 2001 From: erikkaashoek Date: Sun, 21 Jun 2020 10:23:13 +0200 Subject: [PATCH] Remote control improvements --- main.c | 2 ++ sa_cmd.c | 23 +++++++++++++++++------ si4432.c | 19 ++++++++++++------- ui.c | 6 ++++++ ui_sa.c | 2 +- 5 files changed, 38 insertions(+), 14 deletions(-) diff --git a/main.c b/main.c index 06ece57..f2c9181 100644 --- a/main.c +++ b/main.c @@ -153,6 +153,7 @@ static THD_FUNCTION(Thread1, arg) } // Run Shell command in sweep thread if (shell_function) { + operation_requested = false; // otherwise commands will be aborted shell_function(shell_nargs - 1, &shell_args[1]); shell_function = 0; osalThreadSleepMilliseconds(10); @@ -2441,6 +2442,7 @@ static void VNAShell_executeLine(char *line) osalThreadSleepMilliseconds(100); } while (shell_function); } else { + operation_requested = false; // otherwise commands will be aborted scp->sc_function(shell_nargs - 1, &shell_args[1]); if (dirty) { operation_requested = true; // ensure output is updated diff --git a/sa_cmd.c b/sa_cmd.c index 8b3212d..50a53e3 100644 --- a/sa_cmd.c +++ b/sa_cmd.c @@ -127,12 +127,14 @@ VNA_SHELL_FUNCTION(cmd_attenuate) return; } if (strcmp(argv[0],"auto") == 0) { - set_auto_attenuation(); + if (!setting.auto_attenuation) + set_auto_attenuation(); } else { int a = my_atoi(argv[0]); // if (a < 0 || a>31) // goto usage; - set_attenuation(a); + if (setting.attenuate != a) + set_attenuation(a); } redraw_request |= REDRAW_CAL_STATUS | REDRAW_AREA; } @@ -202,13 +204,15 @@ VNA_SHELL_FUNCTION(cmd_rbw) return; } if (strcmp(argv[0],"auto") == 0 || strcmp(argv[0],"0") == 0) { - set_RBW(0); + if (setting.rbw != 0) + set_RBW(0); } else { int a = my_atoi(argv[0]); if (a < 2 || a>600) goto usage; - set_RBW(a); - } + if (setting.rbw != a) + set_RBW(a); + } } VNA_SHELL_FUNCTION(cmd_if) @@ -562,7 +566,14 @@ VNA_SHELL_FUNCTION(cmd_scanraw) float f_step = (stop-start)/ points; setting.frequency_step = (int32_t)f_step; streamPut(shell_stream, '{'); - dirty = true; + static uint32_t old_start=0, old_stop=0, old_points=0; + if (old_start != start || old_stop != stop || old_points != points) { + dirty = true; + old_start = start; + old_stop = stop; + old_points = points; + } + operation_requested = false; for (uint32_t i = 0; i>8) & 0xFF ); - SI4432_Write_Byte ( 0x77, Carrier & 0xFF ); -#else - SI4432_Write_3_Byte ( 0x75, Freq_Band, (Carrier>>8) & 0xFF, Carrier & 0xFF ); -#endif +// if (old_freq_band[SI4432_Sel] == Freq_Band) { +// if (written[SI4432_Sel]++ < 6) +// SI4432_Write_Byte ( 0x75, Freq_Band ); +// SI4432_Write_Byte ( 0x76, (Carrier>>8) & 0xFF ); +// SI4432_Write_Byte ( 0x77, Carrier & 0xFF ); +// } else { + SI4432_Write_3_Byte ( 0x75, Freq_Band, (Carrier>>8) & 0xFF, Carrier & 0xFF); +// old_freq_band[SI4432_Sel] = Freq_Band; +// written[SI4432_Sel] = 0; +// } SI4432_frequency_changed = true; } diff --git a/ui.c b/ui.c index 431b8aa..f993df0 100644 --- a/ui.c +++ b/ui.c @@ -1265,6 +1265,12 @@ menu_invoke(int item) redraw_frame(); // Remove form numbers } kp_help_text = (char *)menu->reference; + if (menu->data <= KM_CW) { // One of the frequency input keypads + if (MODE_LOW(setting.mode)) + kp_help_text = "0..350MHz"; + else + kp_help_text = "240..960Mhz"; + } ui_mode_keypad(menu->data); ui_process_keypad(); } diff --git a/ui_sa.c b/ui_sa.c index 9016933..061455c 100644 --- a/ui_sa.c +++ b/ui_sa.c @@ -524,7 +524,7 @@ static const char * const keypad_mode_label[] = { #ifdef __SA__ static const char * const keypad_mode_label[] = { "error", "START", "STOP", "CENTER", "SPAN", "FREQ", "\2REF\0LEVEL", "SCALE", // 0-7 - "\2ATTENUATE\0 0-31dB", "\2ACTUAL\0POWER", "IF", "\2SAMPLE\0DELAY", "DRIVE", "LEVEL", "SCANS", "LEVEL", // 8-15 + "ATTENUATE", "\2ACTUAL\0POWER", "IF", "\2SAMPLE\0DELAY", "DRIVE", "LEVEL", "SCANS", "LEVEL", // 8-15 "OFFSET" , "\2SAMPLE\0REPEAT", "OFFSET", "\2TRIGGER\0LEVEL", "\2LEVEL\0SWEEP", "\2SWEEP\0SECONDS"// 16- }; #endif