Remote control improvements

pull/4/head
erikkaashoek 6 years ago
parent 63e8cee471
commit 61cc1dc843

@ -153,6 +153,7 @@ static THD_FUNCTION(Thread1, arg)
} }
// Run Shell command in sweep thread // Run Shell command in sweep thread
if (shell_function) { if (shell_function) {
operation_requested = false; // otherwise commands will be aborted
shell_function(shell_nargs - 1, &shell_args[1]); shell_function(shell_nargs - 1, &shell_args[1]);
shell_function = 0; shell_function = 0;
osalThreadSleepMilliseconds(10); osalThreadSleepMilliseconds(10);
@ -2441,6 +2442,7 @@ static void VNAShell_executeLine(char *line)
osalThreadSleepMilliseconds(100); osalThreadSleepMilliseconds(100);
} while (shell_function); } while (shell_function);
} else { } else {
operation_requested = false; // otherwise commands will be aborted
scp->sc_function(shell_nargs - 1, &shell_args[1]); scp->sc_function(shell_nargs - 1, &shell_args[1]);
if (dirty) { if (dirty) {
operation_requested = true; // ensure output is updated operation_requested = true; // ensure output is updated

@ -127,11 +127,13 @@ VNA_SHELL_FUNCTION(cmd_attenuate)
return; return;
} }
if (strcmp(argv[0],"auto") == 0) { if (strcmp(argv[0],"auto") == 0) {
if (!setting.auto_attenuation)
set_auto_attenuation(); set_auto_attenuation();
} else { } else {
int a = my_atoi(argv[0]); int a = my_atoi(argv[0]);
// if (a < 0 || a>31) // if (a < 0 || a>31)
// goto usage; // goto usage;
if (setting.attenuate != a)
set_attenuation(a); set_attenuation(a);
} }
redraw_request |= REDRAW_CAL_STATUS | REDRAW_AREA; redraw_request |= REDRAW_CAL_STATUS | REDRAW_AREA;
@ -202,11 +204,13 @@ VNA_SHELL_FUNCTION(cmd_rbw)
return; return;
} }
if (strcmp(argv[0],"auto") == 0 || strcmp(argv[0],"0") == 0) { if (strcmp(argv[0],"auto") == 0 || strcmp(argv[0],"0") == 0) {
if (setting.rbw != 0)
set_RBW(0); set_RBW(0);
} else { } else {
int a = my_atoi(argv[0]); int a = my_atoi(argv[0]);
if (a < 2 || a>600) if (a < 2 || a>600)
goto usage; goto usage;
if (setting.rbw != a)
set_RBW(a); set_RBW(a);
} }
} }
@ -562,7 +566,14 @@ VNA_SHELL_FUNCTION(cmd_scanraw)
float f_step = (stop-start)/ points; float f_step = (stop-start)/ points;
setting.frequency_step = (int32_t)f_step; setting.frequency_step = (int32_t)f_step;
streamPut(shell_stream, '{'); streamPut(shell_stream, '{');
static uint32_t old_start=0, old_stop=0, old_points=0;
if (old_start != start || old_stop != stop || old_points != points) {
dirty = true; dirty = true;
old_start = start;
old_stop = stop;
old_points = points;
}
operation_requested = false;
for (uint32_t i = 0; i<points; i++) { for (uint32_t i = 0; i<points; i++) {
if (operation_requested) if (operation_requested)
break; break;

@ -290,6 +290,8 @@ void set_10mhz(int f)
} }
int SI4432_frequency_changed = false; int SI4432_frequency_changed = false;
static int old_freq_band[2] = {-1,-1};
static int written[2]= {0,0};
void SI4432_Set_Frequency ( long Freq ) { void SI4432_Set_Frequency ( long Freq ) {
int hbsel; int hbsel;
@ -304,13 +306,16 @@ void SI4432_Set_Frequency ( long Freq ) {
long N = Freq / setting_frequency_10mhz; long N = Freq / setting_frequency_10mhz;
Carrier = ( 4 * ( Freq - N * setting_frequency_10mhz )) / 625; Carrier = ( 4 * ( Freq - N * setting_frequency_10mhz )) / 625;
int Freq_Band = ( N - 24 ) | ( hbsel << 5 ) | ( sbsel << 6 ); int Freq_Band = ( N - 24 ) | ( hbsel << 5 ) | ( sbsel << 6 );
#if 0 // if (old_freq_band[SI4432_Sel] == Freq_Band) {
SI4432_Write_Byte ( 0x75, Freq_Band ); // if (written[SI4432_Sel]++ < 6)
SI4432_Write_Byte ( 0x76, (Carrier>>8) & 0xFF ); // SI4432_Write_Byte ( 0x75, Freq_Band );
SI4432_Write_Byte ( 0x77, Carrier & 0xFF ); // SI4432_Write_Byte ( 0x76, (Carrier>>8) & 0xFF );
#else // SI4432_Write_Byte ( 0x77, Carrier & 0xFF );
SI4432_Write_3_Byte ( 0x75, Freq_Band, (Carrier>>8) & 0xFF, Carrier & 0xFF ); // } else {
#endif 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; SI4432_frequency_changed = true;
} }

@ -1265,6 +1265,12 @@ menu_invoke(int item)
redraw_frame(); // Remove form numbers redraw_frame(); // Remove form numbers
} }
kp_help_text = (char *)menu->reference; 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_mode_keypad(menu->data);
ui_process_keypad(); ui_process_keypad();
} }

@ -524,7 +524,7 @@ static const char * const keypad_mode_label[] = {
#ifdef __SA__ #ifdef __SA__
static const char * const keypad_mode_label[] = { static const char * const keypad_mode_label[] = {
"error", "START", "STOP", "CENTER", "SPAN", "FREQ", "\2REF\0LEVEL", "SCALE", // 0-7 "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- "OFFSET" , "\2SAMPLE\0REPEAT", "OFFSET", "\2TRIGGER\0LEVEL", "\2LEVEL\0SWEEP", "\2SWEEP\0SECONDS"// 16-
}; };
#endif #endif

Loading…
Cancel
Save

Powered by TurnKey Linux.