Listen and Limits added

Removed_REF_marker
erikkaashoek 5 years ago
parent 680967e6f7
commit d8e061a751

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-210558320462039" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-644081821413706" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -17,7 +17,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-210558320462039" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="-644081821413706" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

@ -1063,6 +1063,9 @@ void load_LCD_properties(void)
setting.waterfall = W_OFF;
memcpy(setting._trace, def_trace, sizeof(def_trace));
memcpy(setting._markers, def_markers, sizeof(def_markers));
#ifdef __LIMITS__
memset(setting.limits, 0, sizeof(setting.limits));
#endif
#ifdef __VNA__
setting._velocity_factor = 0.7;
#endif

@ -69,6 +69,7 @@
#define __QUASI_PEAK__ // Add quasi peak average option
#define __REMOTE_DESKTOP__ // Add remote desktop option
#define __LISTEN__
//#define __LIMITS__
#ifdef TINYSA4
#define __HARMONIC__
#endif
@ -291,6 +292,7 @@ void set_attenuation(float);
float get_attenuation(void);
float get_level(void);
void set_harmonic(int);
void set_storage(void);
//extern int setting.harmonic;
int search_is_greater(void);
void set_auto_attenuation(void);
@ -673,6 +675,18 @@ typedef struct {
freq_t frequency;
} marker_t;
#ifdef __LIMITS__
#define LIMITS_MAX 6
typedef struct {
uint8_t enabled;
float level;
freq_t frequency;
int16_t index;
} limit_t;
extern uint8_t active_limit;
extern void limits_update(void);
#endif
#define MARKERS_MAX 4
#define MARKER_INVALID -1
@ -952,7 +966,9 @@ typedef struct setting
float trace_refpos;
trace_t _trace[TRACES_MAX];
marker_t _markers[MARKERS_MAX];
#ifdef __LIMITS__
limit_t limits[LIMITS_MAX];
#endif
systime_t sweep_time_us;
systime_t measure_sweep_time_us;
systime_t actual_sweep_time_us;
@ -1136,6 +1152,7 @@ void menu_move_top(void);
void draw_menu(void);
int check_touched(void);
int invoke_quick_menu(int);
bool ui_process_listen_lever(void);
// Irq operation process set
#define OP_NONE 0x00

@ -772,6 +772,33 @@ void set_attenuation(float a) // Is used both only in high/low input mode
dirty = true;
}
#ifdef __LIMITS__
void limits_update(void)
{
int j = 0;
bool active = false;
for (int i = 0; i<LIMITS_MAX; i++)
{
if (setting.limits[i].enabled) {
active = true;
while (j < sweep_points && (frequencies[j] < setting.limits[i].frequency || setting.limits[i].frequency == 0))
stored_t[j++] = setting.limits[i].level;
}
}
if (active)
{
float old_level = stored_t[j-1];
while (j < sweep_points)
stored_t[j++] = old_level;
setting.show_stored = true;
trace[TRACE_STORED].enabled = true;
} else {
setting.show_stored = false;
trace[TRACE_STORED].enabled = false;
}
}
#endif
void set_storage(void)
{
for (int i=0; i<POINTS_COUNT;i++)
@ -4551,13 +4578,13 @@ void self_test(int test)
// goto do_again;
// }
float saved_peakLevel = peakLevel;
// if (peakLevel < -35) {
// shell_printf("Peak level too low, abort\n\r");
// return;
// }
shell_printf("Start level = %f, ",peakLevel);
#if 0 // Enable for step delay tuning
float saved_peakLevel = peakLevel;
while (setting.step_delay > 10 && test_value != 0 && test_value > saved_peakLevel - 1.5) {
test_prepare(TEST_RBW);
setting.spur_removal = S_OFF;

@ -725,22 +725,23 @@ void SI4432_Listen(int s)
uint16_t sel = SI_nSEL[SI4432_Sel];
uint8_t max = 0;
uint16_t count = 0;
operation_requested = OP_NONE;
do {
uint8_t v;
palClearPad(GPIOC, sel);
shiftOut(SI4432_REG_RSSI);
v = shiftIn();
palSetPad(GPIOC, sel);
if (max < v) // Peak
max = v;
if (count > 1000) { // Decay
max -= 1;
count = 0;
} else
count++;
v = max - v;
dacPutChannelX(&DACD2, 0, dBm_to_volt[v] << 4);
} while((operation_requested & OP_LEVER) != OP_LEVER);
uint8_t v;
palClearPad(GPIOC, sel);
shiftOut(SI4432_REG_RSSI);
v = shiftIn();
palSetPad(GPIOC, sel);
if (max < v) // Peak
max = v;
if (count > 1000) { // Decay
max -= 1;
count = 0;
} else
count++;
v = max - v;
dacPutChannelX(&DACD2, 0, dBm_to_volt[v] << 4);
} while((operation_requested & OP_LEVER) != OP_LEVER);
count = 0;
dacPutChannelX(&DACD2, 0, 0);
}

16
ui.c

@ -2528,6 +2528,22 @@ ui_process_normal(void)
}
}
#ifdef __LISTEN__
bool
ui_process_listen_lever(void)
{
int status = btn_check();
if (status != 0) {
if (status & EVT_BUTTON_SINGLE_CLICK) {
return false;
} else {
lever_move_marker(status);
}
}
return true;
}
#endif
static void
ui_process_menu(void)
{

@ -425,6 +425,9 @@ enum {
KM_ATTACK,
#ifdef TINYSA4
KM_LPF,
#endif
#ifdef __LIMITS__
KM_LIMIT_FREQ, KM_LIMIT_LEVEL,
#endif
// #35
KM_NONE // always at enum end
@ -473,6 +476,10 @@ static const struct {
#ifdef TINYSA4
{keypads_freq , "ULTRA\nSTART"}, // KM_LPF
#endif
#ifdef __LIMITS__
{keypads_freq , "END\nFREQ"}, // KM_LIMIT_FREQ
{keypads_plusmin_unit , "LEVEL"}, // KM_LIMIT_LEVEL
#endif
};
#if 0 // Not used
@ -495,6 +502,7 @@ static const menuitem_t menu_modulation[];
static const menuitem_t menu_top[];
static const menuitem_t menu_reffer[];
static const menuitem_t menu_modulation[];
static const menuitem_t menu_limit_modify[];
//static const menuitem_t menu_drive_wide[];
#ifdef TINYSA4
static const menuitem_t menu_settings3[];
@ -683,7 +691,12 @@ static UI_FUNCTION_CALLBACK(menu_listen_cb)
{
(void)data;
(void)item;
SI4432_Listen(MODE_SELECT(setting.mode));
if (markers[active_marker].enabled == M_ENABLED) {
do {
perform(false,0,frequencies[markers[active_marker].index], false);
SI4432_Listen(MODE_SELECT(setting.mode));
} while (ui_process_listen_lever());
}
}
#endif
@ -1162,6 +1175,24 @@ static UI_FUNCTION_ADV_CALLBACK(menu_marker_select_acb)
redraw_marker(active_marker);
}
#ifdef __LIMITS__
uint8_t active_limit = 0;
static UI_FUNCTION_ADV_CALLBACK(menu_limit_select_acb)
{
(void)item;
if(b){
b->icon = setting.limits[data-1].enabled ? BUTTON_ICON_CHECK : BUTTON_ICON_NOCHECK;
b->param_1.i = data;
return;
}
active_limit = data -1;
setting.limits[active_limit].enabled = true;
limits_update();
menu_push_submenu(menu_limit_modify);
}
#endif
static UI_FUNCTION_ADV_CALLBACK(menu_marker_modify_acb)
{
(void)item;
@ -1212,6 +1243,19 @@ static UI_FUNCTION_CALLBACK(menu_marker_delete_cb)
}
}
#ifdef __LIMITS__
static UI_FUNCTION_CALLBACK(menu_limit_disable_cb)
{
(void)item;
(void)data;
if (active_limit<LIMITS_MAX){
setting.limits[active_limit].enabled = false;
limits_update();
menu_move_back(false);
}
}
#endif
#ifdef TINYSA4
static const uint16_t rbwsel_x10[]={0,3,10,30,100,300,1000,3000,6000};
static const char* rbwsel_text[]={"auto","300","1k","3k","10k","30k","100k","300k","600k"};
@ -1755,6 +1799,28 @@ const menuitem_t menu_marker_modify[] = {
{ MT_NONE, 0, NULL, NULL } // sentinel
};
#ifdef __LIMITS__
static const menuitem_t menu_limit_modify[] =
{
{ MT_KEYPAD, KM_LIMIT_FREQ, "END\nFREQUENCY", "End frequency"},
{ MT_KEYPAD, KM_LIMIT_LEVEL, "LEVEL", "Limit level"},
{ MT_CALLBACK, 0, "DISABLE", menu_limit_disable_cb},
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
const menuitem_t menu_limit_select[] = {
{ MT_ADV_CALLBACK, 1, "LIMIT %d", menu_limit_select_acb },
{ MT_ADV_CALLBACK, 2, "LIMIT %d", menu_limit_select_acb },
{ MT_ADV_CALLBACK, 3, "LIMIT %d", menu_limit_select_acb },
{ MT_ADV_CALLBACK, 4, "LIMIT %d", menu_limit_select_acb },
{ MT_ADV_CALLBACK, 5, "LIMIT %d", menu_limit_select_acb },
{ MT_ADV_CALLBACK, 6, "LIMIT %d", menu_limit_select_acb },
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
{ MT_NONE, 0, NULL, NULL } // sentinel
};
#endif
#if 0
const menuitem_t menu_marker_sel[] = {
{ MT_CALLBACK, 1, "MARKER %d", menu_marker_sel_cb },
@ -1779,7 +1845,6 @@ const menuitem_t menu_marker_select[] = {
{ MT_NONE, 0, NULL, NULL } // sentinel
};
const menuitem_t menu_marker_ops[] = {
{ MT_CALLBACK, ST_START, S_RARROW" START", menu_marker_op_cb },
{ MT_CALLBACK, ST_STOP, S_RARROW" STOP", menu_marker_op_cb },
@ -2056,7 +2121,9 @@ static const menuitem_t menu_display[] = {
// { MT_ADV_CALLBACK,0, "STORE\nTRACE", menu_storage_acb},
// { MT_ADV_CALLBACK,1, "CLEAR\nSTORED", menu_storage_acb},
// { MT_ADV_CALLBACK,2, "SUBTRACT\nSTORED",menu_storage_acb},
{ MT_ADV_CALLBACK,3, "NORMALIZE", menu_storage_acb},
#ifdef __LIMITS__
{ MT_SUBMENU, 0, "LIMITS", menu_limit_select},
#endif
{ MT_ADV_CALLBACK,4, "WATER\nFALL", menu_waterfall_acb},
{ MT_SUBMENU, 0, "SWEEP\nSETTINGS", menu_sweep_speed},
#ifdef __REMOTE_DESKTOP__
@ -2295,6 +2362,16 @@ static void fetch_numeric_target(void)
uistat.value = config.ultra_threshold;
plot_printf(uistat.text, sizeof uistat.text, "%3.6fMHz", uistat.value / 1000000.0);
break;
#endif
#ifdef __LIMITS__
case KM_LIMIT_FREQ:
uistat.value = setting.limits[active_limit].frequency;
plot_printf(uistat.text, sizeof uistat.text, "%3.6fMHz", uistat.value / 1000000.0);
break;
case KM_LIMIT_LEVEL:
uistat.value = setting.limits[active_limit].level;
plot_printf(uistat.text, sizeof uistat.text, "%.1f", uistat.value);
break;
#endif
case KM_NOISE:
uistat.value = setting.noise;
@ -2442,6 +2519,16 @@ set_numeric_value(void)
config.ultra_threshold = uistat.value;
config_save();
break;
#endif
#ifdef __LIMITS__
case KM_LIMIT_FREQ:
setting.limits[active_limit].frequency = uistat.value;
limits_update();
break;
case KM_LIMIT_LEVEL:
setting.limits[active_limit].level = uistat.value;
limits_update();
break;
#endif
case KM_NOISE:
set_noise(uistat.value);

Loading…
Cancel
Save

Powered by TurnKey Linux.