Merge branch 'master' of https://github.com/erikkaashoek/tinySA into DiSlord_test_branch

pull/4/head
DiSlord 6 years ago
commit 53657de9aa

@ -903,6 +903,7 @@ void set_switches(int);
void set_trigger_level(float);
void set_trigger(int);
void update_rbw(void);
void set_fast_speedup(int);
//extern int setting_measurement;
void self_test(int);
//extern int setting_test;

@ -789,6 +789,14 @@ void set_mode(int m)
extern int SI4432_offset_delay;
int fast_speedup = 0;
void set_fast_speedup(int s)
{
fast_speedup = s;
dirty = true;
}
void calculate_step_delay(void)
{
if (setting.step_delay_mode == SD_MANUAL || setting.step_delay != 0) { // The latter part required for selftest 3
@ -823,6 +831,8 @@ void calculate_step_delay(void)
#endif
if (setting.step_delay_mode == SD_PRECISE) // In precise mode wait twice as long for RSSI to stabalize
SI4432_step_delay *= 2;
if (fast_speedup >0)
SI4432_offset_delay = SI4432_step_delay / fast_speedup;
}
if (setting.offset_delay != 0) // Override if set
SI4432_offset_delay = setting.offset_delay;
@ -985,15 +995,27 @@ void set_freq(int V, unsigned long freq) // translate the requested frequency
} else {
#ifdef __WIDE_OFFSET__
uint32_t target_f; // Impossible to use offset so set SI4432 to new frequency
if (freq + 80000 >= 480000000) {
target_f = freq + 160000;
} else {
target_f = freq + 80000;
if (freq < real_old_freq[V]) { // sweeping down
if (freq - 80000 >= 480000000) {
target_f = freq - 160000;
} else {
target_f = freq - 80000;
}
SI4432_Set_Frequency(target_f);
SI4432_Write_Byte(SI4432_FREQ_OFFSET1, 0xff); // set offset to most positive
SI4432_Write_Byte(SI4432_FREQ_OFFSET2, 0x01);
real_old_freq[V] = target_f;
} else { // sweeping up
if (freq + 80000 >= 480000000) {
target_f = freq + 160000;
} else {
target_f = freq + 80000;
}
SI4432_Set_Frequency(target_f);
SI4432_Write_Byte(SI4432_FREQ_OFFSET1, 0); // set offset to most negative
SI4432_Write_Byte(SI4432_FREQ_OFFSET2, 0x02);
real_old_freq[V] = target_f;
}
SI4432_Set_Frequency(target_f);
SI4432_Write_Byte(SI4432_FREQ_OFFSET1, 0); // set offset to most negative
SI4432_Write_Byte(SI4432_FREQ_OFFSET2, 0x02);
real_old_freq[V] = target_f;
#else
SI4432_Set_Frequency(freq); // Impossible to use offset so set SI4432 to new frequency
SI4432_Write_Byte(SI4432_FREQ_OFFSET1, 0); // set offset to zero
@ -1136,7 +1158,13 @@ void update_rbw(void) // calculate the actual_rbw and the vbwSteps (#
}
actual_rbw_x10 = setting.rbw_x10; // requested rbw
if (actual_rbw_x10 == 0) { // if auto rbw
actual_rbw_x10 = 2*setting.vbw_x10; // rbw is twice the frequency step to ensure no gaps in coverage
if (setting.step_delay_mode==SD_FAST) { // if in fast scanning
if (fast_speedup > 2)
actual_rbw_x10 = 6*setting.vbw_x10; // rbw is four the frequency step to ensure no gaps in coverage as there are some weird jumps
else
actual_rbw_x10 = 4*setting.vbw_x10; // rbw is four the frequency step to ensure no gaps in coverage as there are some weird jumps
} else
actual_rbw_x10 = 2*setting.vbw_x10; // rbw is twice the frequency step to ensure no gaps in coverage
}
if (actual_rbw_x10 < 26)
actual_rbw_x10 = 26;

@ -301,7 +301,7 @@ const uint16_t right_icons [] =
enum {
KM_START=1, KM_STOP, KM_CENTER, KM_SPAN, KM_CW, KM_REFLEVEL, KM_SCALE, KM_ATTENUATION,
KM_ACTUALPOWER, KM_IF, KM_SAMPLETIME, KM_DRIVE, KM_LOWOUTLEVEL, KM_DECAY, KM_NOISE,
KM_10MHZ, KM_REPEAT, KM_OFFSET, KM_TRIGGER, KM_LEVELSWEEP, KM_SWEEP_TIME, KM_OFFSET_DELAY,
KM_10MHZ, KM_REPEAT, KM_OFFSET, KM_TRIGGER, KM_LEVELSWEEP, KM_SWEEP_TIME, KM_OFFSET_DELAY, KM_FAST_SPEEDUP
};
@ -516,6 +516,7 @@ static const keypads_t * const keypads_mode_tbl[] = {
keypads_plusmin, // KM_LEVELSWEEP
keypads_time, // KM_SWEEP_TIME
keypads_positive, // KM_OFFSET_DELAY
keypads_positive, // KM_FAST_SPEEDUP
};
#ifdef __VNA__
@ -527,7 +528,7 @@ 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
"ATTENUATE", "\2ACTUAL\0POWER", "IF", "\2SAMPLE\0DELAY", "DRIVE", "LEVEL", "SCANS", "LEVEL", // 8-15
"FREQ" , "\2SAMPLE\0REPEAT", "OFFSET", "\2TRIGGER\0LEVEL", "\2LEVEL\0SWEEP", "\2SWEEP\0SECONDS", "\2OFFSET\0DELAY" // 16-
"FREQ" , "\2SAMPLE\0REPEAT", "OFFSET", "\2TRIGGER\0LEVEL", "\2LEVEL\0SWEEP", "\2SWEEP\0SECONDS", "\2OFFSET\0DELAY", "\2FAST\0SPEEDUP" // 16-
};
#endif
@ -1290,7 +1291,7 @@ static const menuitem_t menu_atten[] = {
{ MT_CALLBACK | MT_LOW, 0, "AUTO", menu_atten_cb},
{ MT_KEYPAD | MT_LOW, KM_ATTENUATION, "MANUAL", "0..30"},
{ MT_CALLBACK | MT_HIGH,0, "0dB", menu_atten_high_cb},
{ MT_CALLBACK | MT_HIGH,30, "\00225..30dB", menu_atten_high_cb},
{ MT_CALLBACK | MT_HIGH,30, "\00225..40dB", menu_atten_high_cb},
{ MT_CANCEL, 0, "\032 BACK", NULL },
{ MT_FORM | MT_NONE, 0, NULL, NULL } // sentinel
};
@ -1392,6 +1393,7 @@ static const menuitem_t menu_scanning_speed[] =
{ MT_CALLBACK, SD_NORMAL, "NORMAL", menu_scanning_speed_cb}, // order must match definition of enum
{ MT_CALLBACK, SD_PRECISE, "PRECISE", menu_scanning_speed_cb},
{ MT_CALLBACK | MT_LOW,SD_FAST, "FAST", menu_scanning_speed_cb},
{ MT_KEYPAD | MT_LOW,KM_FAST_SPEEDUP, "\2FAST\0SPEEDUP", "2..20"},
{ MT_KEYPAD, KM_SAMPLETIME, "\2SAMPLE\0DELAY", "300..30000"}, // item number must match SD_MANUAL
{ MT_KEYPAD, KM_OFFSET_DELAY, "\2OFFSET\0DELAY", "300..30000"}, // item number must match SD_MANUAL
{ MT_CANCEL, 0, "\032 BACK", NULL },
@ -1941,6 +1943,9 @@ set_numeric_value(void)
case KM_OFFSET_DELAY:
set_offset_delay(uistat.value);
break;
case KM_FAST_SPEEDUP:
set_fast_speedup(uistat.value);
break;
case KM_REPEAT:
set_repeat(uistat.value);
break;

Loading…
Cancel
Save

Powered by TurnKey Linux.