Max shift to 4GHz

Removed_REF_marker
erikkaashoek 5 years ago
parent 12e912d7f1
commit 90b2f9c484

@ -88,7 +88,7 @@ static char *long_to_string_with_divisor(char *p,
#define FREQ_PREFIX_SPACE 4
static char *
ulong_freq(char *p, long_t freq, uint32_t precision)
ulong_freq(char *p, ulong_t freq, uint32_t precision)
{
uint8_t flag = FREQ_PSET;
flag|= precision == 0 ? FREQ_PREFIX_SPACE : FREQ_NO_SPACE;

@ -1017,7 +1017,7 @@ config_t config = {
.high_level_output_offset = 0.0, // Uncalibrated
.correction_frequency = {{ 1000000, 500000000, 1000000000, 1500000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000, 6500000000, 7000000000, 7500000000, 8000000000, 8500000000, 9000000000, 10000000000 },
{ 1000000, 500000000, 1000000000, 1500000000, 2000000000, 2500000000, 3000000000, 3500000000, 4000000000, 4500000000, 5000000000, 5500000000, 6000000000, 6500000000, 7000000000, 7500000000, 8000000000, 8500000000, 9000000000, 10000000000 }},
.correction_value = {{ 0, +1.5, +4, +4, +2, +3.5, +8, +12, +15, +13, +12, +23, +27, +27, +27, +27, +27, +27, +27, +27 },
.correction_value = {{ 0, +1.5, +4, +4, +2, +3.5, +8, +12, +15, +13, +12, +23, +26, +26, +26, +26, +26, +27, +27, +27 },
{ 0, +1, +4.5, +1, +2.5, +6.5, +9, +15, +15.5, +28, +29, +41, +48, +48, +48, +48, +48, +48, +48, +48 }},
.setting_frequency_30mhz = 30000000,
.cor_am = 0,

@ -986,8 +986,8 @@ typedef struct setting
freq_t frequency0;
freq_t frequency1;
freq_t frequency_IF;
long_t frequency_offset;
freq_t frequency_offset;
#define FREQUENCY_SHIFT 100000000 // 100MHz upconversion maximum
float trace_scale;
float trace_refpos;
trace_t _trace[TRACES_MAX];

@ -129,7 +129,7 @@ float2int(float v)
void update_grid(void)
{
freq_t gdigit = 1000000000;
freq_t fstart = get_sweep_frequency(ST_START) + setting.frequency_offset;
freq_t fstart = get_sweep_frequency(ST_START) + (setting.frequency_offset - FREQUENCY_SHIFT);
freq_t fspan = get_sweep_frequency(ST_SPAN);
freq_t grid;
@ -209,7 +209,7 @@ const ham_bands_t ham_bands[] =
int ham_band(int x) // Search which index in the frequency tabled matches with frequency f using actual_rbw
{
freq_t f = frequencies[x] + setting.frequency_offset;
freq_t f = frequencies[x] + (setting.frequency_offset - FREQUENCY_SHIFT);
int L = 0;
int R = (sizeof ham_bands)/sizeof(freq_t) - 1;
while (L <= R) {
@ -1348,7 +1348,7 @@ static void trace_print_value_string( // Only used at one place
else {freq = freq - ref_freq; idx = idx - ridx; *ptr2++ = '+';}
v-= value(coeff[ridx]);
} else
freq += setting.frequency_offset;
freq += (setting.frequency_offset - FREQUENCY_SHIFT);
// For CW mode output time
if (FREQ_IS_CW()) {
@ -1534,24 +1534,25 @@ static void cell_draw_marker_info(int x0, int y0)
void
draw_frequencies(void)
{
char buf1[32];
char buf1[40];
char buf2[32];
if (MODE_OUTPUT(setting.mode)) // No frequencies during output
return;
if (current_menu_is_form() && !in_selftest)
return;
char *shift = (setting.frequency_offset == FREQUENCY_SHIFT ? "" : "shifted");
if (FREQ_IS_CW()) {
plot_printf(buf1, sizeof(buf1), " CW %QHz", get_sweep_frequency(ST_CW) + setting.frequency_offset);
plot_printf(buf1, sizeof(buf1), " CW %QHz", get_sweep_frequency(ST_CW) + (setting.frequency_offset - FREQUENCY_SHIFT));
// Show user actual select sweep time?
uint32_t t = setting.actual_sweep_time_us;
plot_printf(buf2, sizeof(buf2), " TIME %.3Fs", (float)t/ONE_SECOND_TIME);
} else if (FREQ_IS_STARTSTOP()) {
plot_printf(buf1, sizeof(buf1), " START %.3QHz %5.1QHz/", get_sweep_frequency(ST_START) + setting.frequency_offset, grid_span);
plot_printf(buf2, sizeof(buf2), " STOP %.3QHz", get_sweep_frequency(ST_STOP) + setting.frequency_offset);
plot_printf(buf1, sizeof(buf1), " START %.3QHz %5.1QHz/ %s", get_sweep_frequency(ST_START) + (setting.frequency_offset - FREQUENCY_SHIFT), grid_span, shift);
plot_printf(buf2, sizeof(buf2), " STOP %.3QHz", get_sweep_frequency(ST_STOP) + (setting.frequency_offset - FREQUENCY_SHIFT));
} else if (FREQ_IS_CENTERSPAN()) {
plot_printf(buf1, sizeof(buf1), " CENTER %.3QHz %5.1QHz/", get_sweep_frequency(ST_CENTER) + setting.frequency_offset, grid_span);
plot_printf(buf1, sizeof(buf1), " CENTER %.3QHz %5.1QHz/ %s", get_sweep_frequency(ST_CENTER) + (setting.frequency_offset - FREQUENCY_SHIFT), grid_span, shift);
plot_printf(buf2, sizeof(buf2), " SPAN %.3QHz", get_sweep_frequency(ST_SPAN));
}
ili9341_set_foreground(LCD_FG_COLOR);
@ -1567,6 +1568,12 @@ draw_frequencies(void)
// }
ili9341_drawstring(buf2, p2, FREQUENCIES_YPOS);
ili9341_drawstring(buf1, FREQUENCIES_XPOS1, FREQUENCIES_YPOS);
#ifdef TINYSA4
if (get_sweep_frequency(ST_STOP) > 2000000000ULL && setting.attenuate_x2 >= 16 ) {
ili9341_set_foreground(LCD_BRIGHT_COLOR_RED);
ili9341_drawstring("REDUCED LINEARITY", p2 - 18*7, FREQUENCIES_YPOS);
}
#endif
}
// Draw battery level
@ -1642,7 +1649,7 @@ int display_test(void)
return true;
}
//#define _USE_WATERFALL_PALETTE
#define _USE_WATERFALL_PALETTE
#ifdef _USE_WATERFALL_PALETTE
#include "waterfall.c"
#endif
@ -1664,12 +1671,12 @@ static void update_waterfall(void){
for (i=0; i< sweep_points; i++) { // Add new topline
uint16_t color;
#ifdef _USE_WATERFALL_PALETTE
uint16_t y = _PALETTE_ALIGN(CELL_Y(index[i])); // should be always in range 0 - graph_bottom
uint16_t y = _PALETTE_ALIGN(256 - graph_bottom + index[i]); // should be always in range 0 - graph_bottom
// y = (uint8_t)i; // for test
color = waterfall_palette[y];
#elif 0
#elif 1
uint16_t y = index[i]; // should be always in range 0 - graph_bottom
uint16_t ratio = (graph_bottom - y)*2;
uint16_t ratio = (graph_bottom - y)*4;
// ratio = (i*2); // Uncomment for testing the waterfall colors
int16_t b = 255 - ratio;
if (b > 255) b = 255;

@ -230,7 +230,7 @@ void reset_settings(int m)
#else
setting.frequency_IF = DEFAULT_IF;
#endif
setting.frequency_offset = 0;
setting.frequency_offset = FREQUENCY_SHIFT;
setting.auto_IF = true;
set_external_gain(0.0); // This also updates the help text!!!!!
//setting.external_gain = 0.0;
@ -2482,11 +2482,13 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) /
#endif
#ifdef TINYSA4
// ----------------------------- set mixer drive --------------------------------------------
if (setting.lo_drive & 0x40){
int target_drive = 1;
if (f >=400000000ULL)
if (setting.lo_drive & 0x04){
int target_drive;
if (f < 400000000ULL)
target_drive = 1;
else if (f < 2000000000ULL)
target_drive = 2;
else if (f >=2000000000ULL)
else
target_drive = 3;
if (old_drive != target_drive) {
ADF4351_drive(target_drive); // Max drive

@ -1541,18 +1541,18 @@ static UI_FUNCTION_ADV_CALLBACK(menu_shift_acb)
(void) data;
(void) item;
if (b){
b->icon = setting.frequency_offset != 0 ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
b->icon = setting.frequency_offset != FREQUENCY_SHIFT ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
return;
}
if (setting.frequency_offset != 0) {
setting.frequency_offset = 0;
if (setting.frequency_offset != FREQUENCY_SHIFT) {
setting.frequency_offset = FREQUENCY_SHIFT;
} else {
if (FREQ_IS_STARTSTOP()) {
freq_t old_start = get_sweep_frequency(ST_START);
freq_t old_stop = get_sweep_frequency(ST_STOP);
kp_help_text = "Actual start frequency";
ui_mode_keypad(KM_START);
setting.frequency_offset = uistat.value - old_start;
setting.frequency_offset = uistat.value - old_start + FREQUENCY_SHIFT;
set_sweep_frequency(ST_START, old_start);
set_sweep_frequency(ST_STOP, old_stop);
} else {
@ -1560,7 +1560,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_shift_acb)
freq_t old_span = get_sweep_frequency(ST_SPAN);
kp_help_text = "Actual center frequency";
ui_mode_keypad(KM_CENTER);
setting.frequency_offset = uistat.value - old_center;
setting.frequency_offset = uistat.value - old_center + FREQUENCY_SHIFT;
set_sweep_frequency(ST_CENTER, old_center);
set_sweep_frequency(ST_SPAN, old_span);
}
@ -2196,10 +2196,12 @@ static const menuitem_t menu_config[] = {
{ MT_SUBMENU, 0, "LEVEL CAL", menu_calibrate},
#endif
{ MT_CALLBACK, CONFIG_MENUITEM_VERSION, "VERSION", menu_config_cb},
#ifdef __SPUR__
{ MT_ADV_CALLBACK,0, "%s", menu_spur_acb},
#endif
#ifdef __USE_SERIAL_CONSOLE__
{ MT_SUBMENU, 0, "CONNECTION", menu_connection},
#endif
{ MT_ADV_CALLBACK,0,"SHIFT\nFREQ", menu_shift_acb},
{ MT_SUBMENU, 0, "EXPERT\nCONFIG", menu_settings},
{ MT_SUBMENU, 0, S_RARROW" DFU", menu_dfu},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
@ -2288,9 +2290,7 @@ static const menuitem_t menu_stimulus[] = {
{ MT_KEYPAD, KM_SPAN, "SPAN", NULL},
{ MT_KEYPAD, KM_CW, "ZERO SPAN", NULL},
{ MT_SUBMENU,0, "RBW", menu_rbw},
#ifdef __SPUR__
{ MT_ADV_CALLBACK,0, "%s", menu_spur_acb},
#endif
{ MT_ADV_CALLBACK,0, "SHIFT\nFREQ", menu_shift_acb},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
@ -2368,15 +2368,15 @@ static void fetch_numeric_target(void)
{
switch (keypad_mode) {
case KM_START:
uistat.value = get_sweep_frequency(ST_START) + setting.frequency_offset;
uistat.value = get_sweep_frequency(ST_START) + (setting.frequency_offset - FREQUENCY_SHIFT);
plot_printf(uistat.text, sizeof uistat.text, "%3.3fMHz", uistat.value / 1000000.0);
break;
case KM_STOP:
uistat.value = get_sweep_frequency(ST_STOP) + setting.frequency_offset;
uistat.value = get_sweep_frequency(ST_STOP) + (setting.frequency_offset - FREQUENCY_SHIFT);
plot_printf(uistat.text, sizeof uistat.text, "%3.3fMHz", uistat.value / 1000000.0);
break;
case KM_CENTER:
uistat.value = get_sweep_frequency(ST_CENTER) + setting.frequency_offset;
uistat.value = get_sweep_frequency(ST_CENTER) + (setting.frequency_offset - FREQUENCY_SHIFT);
plot_printf(uistat.text, sizeof uistat.text, "%3.4fMHz", uistat.value / 1000000.0);
break;
case KM_SPAN:
@ -2384,7 +2384,7 @@ static void fetch_numeric_target(void)
plot_printf(uistat.text, sizeof uistat.text, "%3.3fMHz", uistat.value / 1000000.0);
break;
case KM_CW:
uistat.value = get_sweep_frequency(ST_CW) + setting.frequency_offset;
uistat.value = get_sweep_frequency(ST_CW) + (setting.frequency_offset - FREQUENCY_SHIFT);
plot_printf(uistat.text, sizeof uistat.text, "%3.3fMHz", uistat.value / 1000000.0);
break;
case KM_SCALE:
@ -2538,20 +2538,20 @@ set_numeric_value(void)
{
switch (keypad_mode) {
case KM_START:
set_sweep_frequency(ST_START, (freq_t)uistat.value - setting.frequency_offset);
set_sweep_frequency(ST_START, (freq_t)uistat.value - (setting.frequency_offset - FREQUENCY_SHIFT));
break;
case KM_STOP:
set_sweep_frequency(ST_STOP, (freq_t)uistat.value - setting.frequency_offset);
set_sweep_frequency(ST_STOP, (freq_t)uistat.value - (setting.frequency_offset - FREQUENCY_SHIFT));
break;
case KM_CENTER:
set_sweep_frequency(ST_CENTER, (freq_t)uistat.value - setting.frequency_offset);
set_sweep_frequency(ST_CENTER, (freq_t)uistat.value - (setting.frequency_offset - FREQUENCY_SHIFT));
break;
case KM_SPAN:
setting.modulation = MO_NONE;
set_sweep_frequency(ST_SPAN, (freq_t)uistat.value);
break;
case KM_CW:
set_sweep_frequency(ST_CW, (freq_t)uistat.value - setting.frequency_offset);
set_sweep_frequency(ST_CW, (freq_t)uistat.value - (setting.frequency_offset - FREQUENCY_SHIFT));
break;
case KM_SCALE:
user_set_scale(uistat.value);
@ -2624,7 +2624,7 @@ set_numeric_value(void)
#endif
#ifdef __LIMITS__
case KM_LIMIT_FREQ:
setting.limits[active_limit].frequency = uistat.value - setting.frequency_offset;
setting.limits[active_limit].frequency = uistat.value - (setting.frequency_offset - FREQUENCY_SHIFT);
limits_update();
break;
case KM_LIMIT_LEVEL:
@ -2666,7 +2666,7 @@ set_numeric_value(void)
set_gridlines(uistat.value);
break;
case KM_MARKER:
set_marker_frequency(active_marker, (freq_t)uistat.value - setting.frequency_offset);
set_marker_frequency(active_marker, (freq_t)uistat.value - (setting.frequency_offset - FREQUENCY_SHIFT));
break;
case KM_MODULATION:
set_modulation_frequency((int)uistat.value);

Loading…
Cancel
Save

Powered by TurnKey Linux.