feat: add lever operation of electrical delay

pull/1/head
TT 6 years ago
parent 7f5948c4b8
commit 18c5ca9157

@ -1667,6 +1667,7 @@ void set_electrical_delay(float picoseconds)
electrical_delay = picoseconds; electrical_delay = picoseconds;
force_set_markmap(); force_set_markmap();
} }
redraw_request |= REDRAW_MARKER;
} }
float get_electrical_delay(void) float get_electrical_delay(void)

@ -410,7 +410,7 @@ void clear_all_config_prop_data(void);
// lever_mode // lever_mode
enum lever_mode { enum lever_mode {
LM_MARKER, LM_SEARCH, LM_CENTER, LM_SPAN LM_MARKER, LM_SEARCH, LM_CENTER, LM_SPAN, LM_EDELAY
}; };
// marker smith value format // marker smith value format

@ -1599,6 +1599,10 @@ cell_draw_marker_info(int m, int n, int w, int h)
xpos -= m * CELLWIDTH -CELLOFFSETX; xpos -= m * CELLWIDTH -CELLOFFSETX;
ypos -= n * CELLHEIGHT; ypos -= n * CELLHEIGHT;
if (uistat.lever_mode == LM_EDELAY)
cell_drawstring(w, h, S_SARROW, xpos, ypos);
xpos += 5;
float light_speed_ps = 299792458e-12; //(m/ps) float light_speed_ps = 299792458e-12; //(m/ps)
chsnprintf(buf, sizeof buf, "Edelay %Fs %Fm", electrical_delay * 1e-12, chsnprintf(buf, sizeof buf, "Edelay %Fs %Fm", electrical_delay * 1e-12,
electrical_delay * light_speed_ps * velocity_factor); electrical_delay * light_speed_ps * velocity_factor);

31
ui.c

@ -1756,6 +1756,23 @@ lever_move(int status, int mode)
} }
} }
#define STEPRATIO 0.2
static void
lever_edelay(int status)
{
float value = get_electrical_delay();
float ratio = STEPRATIO;
if (value < 0)
ratio = -ratio;
if (status & EVT_UP) {
value = (1 - ratio) * value;
} else if (status & EVT_DOWN) {
value = (1 + ratio) * value;
}
set_electrical_delay(value);
}
static void static void
ui_process_normal(void) ui_process_normal(void)
{ {
@ -1774,7 +1791,10 @@ ui_process_normal(void)
if (FREQ_IS_STARTSTOP()) if (FREQ_IS_STARTSTOP())
lever_move(status, ST_STOP); lever_move(status, ST_STOP);
else else
lever_zoom_span(status); lever_zoom_span(status);
break;
case LM_EDELAY:
lever_edelay(status);
break; break;
} }
} }
@ -2148,15 +2168,18 @@ touch_lever_mode_select(void)
touch_position(&touch_x, &touch_y); touch_position(&touch_x, &touch_y);
if (touch_y > HEIGHT) { if (touch_y > HEIGHT) {
if (touch_x < 160) { if (touch_x < 160) {
select_lever_mode(LM_CENTER); select_lever_mode(LM_CENTER);
} else { } else {
select_lever_mode(LM_SPAN); select_lever_mode(LM_SPAN);
} }
return TRUE; return TRUE;
} }
if (touch_y < 15) { if (touch_y < 15) {
select_lever_mode(LM_MARKER); if (touch_x < 160 && get_electrical_delay() != 0.0) {
select_lever_mode(LM_EDELAY);
} else
select_lever_mode(LM_MARKER);
return TRUE; return TRUE;
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.