|
|
|
|
@ -71,9 +71,14 @@ enum {
|
|
|
|
|
KM_START, KM_STOP, KM_CENTER, KM_SPAN, KM_CW, KM_SCALE, KM_REFPOS, KM_EDELAY, KM_VELOCITY_FACTOR, KM_SCALEDELAY
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
LM_MARKER, LM_SEARCH, LM_CENTER, LM_SPAN
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
uint8_t ui_mode = UI_NORMAL;
|
|
|
|
|
uint8_t keypad_mode;
|
|
|
|
|
int8_t selection = 0;
|
|
|
|
|
uint8_t lever_mode = LM_MARKER;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
uint8_t type;
|
|
|
|
|
@ -774,6 +779,7 @@ menu_stimulus_cb(int item)
|
|
|
|
|
ui_mode_keypad(item);
|
|
|
|
|
ui_process_keypad();
|
|
|
|
|
}
|
|
|
|
|
lever_mode = item == 3 ? LM_SPAN : LM_CENTER;
|
|
|
|
|
break;
|
|
|
|
|
case 5: /* PAUSE */
|
|
|
|
|
toggle_sweep();
|
|
|
|
|
@ -867,6 +873,7 @@ menu_marker_search_cb(int item)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
redraw_marker(active_marker, TRUE);
|
|
|
|
|
lever_mode = LM_SEARCH;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
@ -911,6 +918,7 @@ menu_marker_sel_cb(int item)
|
|
|
|
|
}
|
|
|
|
|
redraw_marker(active_marker, TRUE);
|
|
|
|
|
draw_menu();
|
|
|
|
|
lever_mode = LM_MARKER;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const menuitem_t menu_calop[] = {
|
|
|
|
|
@ -1666,13 +1674,8 @@ ui_mode_normal(void)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
ui_process_normal(void)
|
|
|
|
|
lever_move_marker(int status)
|
|
|
|
|
{
|
|
|
|
|
int status = btn_check();
|
|
|
|
|
if (status != 0) {
|
|
|
|
|
if (status & EVT_BUTTON_SINGLE_CLICK) {
|
|
|
|
|
ui_mode_menu();
|
|
|
|
|
} else {
|
|
|
|
|
do {
|
|
|
|
|
if (active_marker >= 0 && markers[active_marker].enabled) {
|
|
|
|
|
if ((status & EVT_DOWN) && markers[active_marker].index > 0) {
|
|
|
|
|
@ -1691,6 +1694,87 @@ ui_process_normal(void)
|
|
|
|
|
if (active_marker >= 0)
|
|
|
|
|
redraw_marker(active_marker, TRUE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
lever_search_marker(int status)
|
|
|
|
|
{
|
|
|
|
|
if (active_marker >= 0) {
|
|
|
|
|
if (status & EVT_DOWN) {
|
|
|
|
|
int i = marker_search_left(markers[active_marker].index);
|
|
|
|
|
if (i != -1)
|
|
|
|
|
markers[active_marker].index = i;
|
|
|
|
|
} else if (status & EVT_UP) {
|
|
|
|
|
int i = marker_search_right(markers[active_marker].index);
|
|
|
|
|
if (i != -1)
|
|
|
|
|
markers[active_marker].index = i;
|
|
|
|
|
}
|
|
|
|
|
redraw_marker(active_marker, TRUE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ex. 10942 -> 10000
|
|
|
|
|
// 6791 -> 5000
|
|
|
|
|
// 341 -> 200
|
|
|
|
|
static uint32_t
|
|
|
|
|
step_round(uint32_t v)
|
|
|
|
|
{
|
|
|
|
|
// decade step
|
|
|
|
|
uint32_t x = 1;
|
|
|
|
|
for (x = 1; x * 10 < v; x *= 10)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
// 1-2-5 step
|
|
|
|
|
if (x * 2 > v)
|
|
|
|
|
return x;
|
|
|
|
|
else if (x * 5 > v)
|
|
|
|
|
return x * 2;
|
|
|
|
|
else
|
|
|
|
|
return x * 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
lever_zoom_span(int status)
|
|
|
|
|
{
|
|
|
|
|
if (status & EVT_UP) {
|
|
|
|
|
uint32_t span = get_sweep_frequency(ST_SPAN);
|
|
|
|
|
span = step_round(span - 1);
|
|
|
|
|
set_sweep_frequency(ST_SPAN, span);
|
|
|
|
|
} else if (status & EVT_DOWN) {
|
|
|
|
|
uint32_t span = get_sweep_frequency(ST_SPAN);
|
|
|
|
|
span = step_round(span);
|
|
|
|
|
span = step_round(span * 3);
|
|
|
|
|
set_sweep_frequency(ST_SPAN, span);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
lever_move_center(int status)
|
|
|
|
|
{
|
|
|
|
|
uint32_t center = get_sweep_frequency(ST_CENTER);
|
|
|
|
|
uint32_t span = get_sweep_frequency(ST_SPAN);
|
|
|
|
|
span = step_round(span / 3);
|
|
|
|
|
if (status & EVT_UP) {
|
|
|
|
|
set_sweep_frequency(ST_CENTER, center + span);
|
|
|
|
|
} else if (status & EVT_DOWN) {
|
|
|
|
|
set_sweep_frequency(ST_CENTER, center - span);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
ui_process_normal(void)
|
|
|
|
|
{
|
|
|
|
|
int status = btn_check();
|
|
|
|
|
if (status != 0) {
|
|
|
|
|
if (status & EVT_BUTTON_SINGLE_CLICK) {
|
|
|
|
|
ui_mode_menu();
|
|
|
|
|
} else {
|
|
|
|
|
switch (lever_mode) {
|
|
|
|
|
case LM_MARKER: lever_move_marker(status); break;
|
|
|
|
|
case LM_SEARCH: lever_search_marker(status); break;
|
|
|
|
|
case LM_CENTER: lever_move_center(status); break;
|
|
|
|
|
case LM_SPAN: lever_zoom_span(status); break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|