Quick button for CALC menu and temperature compensation added

Removed_REF_marker
erikkaashoek 5 years ago
parent b00979a31b
commit 8790f22a27

@ -1401,5 +1401,6 @@ extern bool ADF4351_frequency_changed;
extern bool SI4463_frequency_changed;
extern bool SI4463_offset_changed;
extern int old_R;
extern float Si446x_get_temp(void);
#endif
/*EOF*/

@ -293,7 +293,7 @@ void reset_settings(int m)
#endif
set_sweep_frequency(ST_CENTER, 10000000);
set_sweep_frequency(ST_SPAN, 0);
setting.sweep_time_us = 10*ONE_SECOND_TIME;
setting.sweep_time_us = 2*ONE_SECOND_TIME;
setting.step_delay_mode = SD_FAST;
#ifdef TINYSA4
setting.extra_lna = false;
@ -328,7 +328,7 @@ void reset_settings(int m)
set_sweep_frequency(ST_CENTER, 300000000);
#endif
set_sweep_frequency(ST_SPAN, 0);
setting.sweep_time_us = 10*ONE_SECOND_TIME;
setting.sweep_time_us = 2*ONE_SECOND_TIME;
setting.step_delay_mode = SD_FAST;
setting.correction_frequency = config.correction_frequency[CORRECTION_HIGH];
setting.correction_value = config.correction_value[CORRECTION_HIGH];
@ -1073,7 +1073,7 @@ void set_offset_delay(int d) // override RSSI measurement delay
void set_average(int v)
{
if (setting.average == v)
if (setting.average == v) // Clear calc on second click
dirty = true;
setting.average = v;
trace[TRACE_TEMP].enabled = ((v != 0)
@ -2512,6 +2512,7 @@ int test_output = false;
int test_output_switch = false;
int test_output_drive = 0;
int test_output_attenuate = 0;
int start_temperature = 0;
#endif
pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) // Measure the RSSI for one frequency, used from sweep and other measurement routines. Must do all HW setup
@ -2557,8 +2558,10 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) /
if (!in_selftest) clock_above_48MHz();
is_below = false;
correct_RSSI_freq = get_frequency_correction(f); // for i == 0 and freq_step == 0;
} else
} else {
clock_at_48MHz();
start_temperature = Si446x_get_temp();
}
// if (MODE_OUTPUT(setting.mode) && setting.additional_step_delay_us < 500) // Minimum wait time to prevent LO from lockup during output frequency sweep
// setting.additional_step_delay_us = 500;
// Update grid and status after
@ -2626,6 +2629,7 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) /
correct_RSSI_freq = get_frequency_correction(f);
a += PURE_TO_float(correct_RSSI_freq);
#ifdef TINYSA4
a += (Si446x_get_temp() - 34.0) * 0.0433; // Temperature correction
a += 3.0; // Always 3dB in attenuator
#endif
if (a != old_a) {
@ -2695,6 +2699,10 @@ pureRSSI_t perform(bool break_on_operation, int i, freq_t f, int tracking) /
}
else if (setting.mode == M_GENHIGH) {
float a = setting.level - level_max();
#ifdef TINYSA4
if (!config.high_out_adf4350)
a += (Si446x_get_temp() - 34.0) * 0.0433; // Temperature correction
#endif
if (a <= -SWITCH_ATTENUATION) {
setting.atten_step = true;
a = a + SWITCH_ATTENUATION;

@ -1213,7 +1213,7 @@ float Si446x_get_temp(void)
uint8_t data[8] = { SI446X_CMD_GET_ADC_READING, 0x10, 0 };
SI4463_do_api(data, 3, data, 8);
int i = 4;
if (MODE_OUTPUT(setting.mode))
if (data[0]==255)
i = 6;
float t = (data[i] << 8) + data[i+1];
t = (899.0 * t /4096.0) - 293.0;

@ -1402,6 +1402,7 @@ static UI_FUNCTION_ADV_CALLBACK(menu_average_acb)
return;
}
set_average(data);
ui_mode_normal();
// menu_move_back(true);
}
@ -3435,7 +3436,8 @@ redraw_cal_status:
else
color = LCD_BRIGHT_COLOR_RED;
ili9341_set_foreground(color);
ili9341_drawstring(buf, x, y);
y = add_quick_menu(buf, x, y,(menuitem_t *)menu_average);
// ili9341_drawstring(buf, x, y);
}
}

Loading…
Cancel
Save

Powered by TurnKey Linux.