setting velocity factor

scan_delay_optimize
cho45 6 years ago
parent 95ab399567
commit 8f0bfacf3d

@ -547,6 +547,8 @@ properties_t current_props = {
{ 1, 30, 0 }, { 0, 40, 0 }, { 0, 60, 0 }, { 0, 80, 0 }
},
/* active_marker */ 0,
/* domain_mode */ 0,
/* velocity_factor */ 70,
/* checksum */ 0
};
properties_t *active_props = &current_props;

@ -299,6 +299,7 @@ typedef struct {
marker_t _markers[4];
int _active_marker;
uint8_t _domain_mode;
uint8_t _velocity_factor; // %
int32_t checksum;
} properties_t;
@ -323,6 +324,7 @@ extern int8_t previous_marker;
#define markers current_props._markers
#define active_marker current_props._active_marker
#define domain_mode current_props._domain_mode
#define velocity_factor current_props._velocity_factor
int caldata_save(int id);
int caldata_recall(int id);

@ -1373,7 +1373,7 @@ cell_draw_marker_info(int m, int n, int w, int h)
} else {
#define SPEED_OF_LIGHT 299792458
float distance = ((float)idx * (float)SPEED_OF_LIGHT) / ( (float)(frequencies[1] - frequencies[0]) * 128.0 * 2.0);
chsnprintf(buf, sizeof buf, "%f m", distance);
chsnprintf(buf, sizeof buf, "%.1f m (%d%%)", distance * (velocity_factor / 100.0), velocity_factor);
cell_drawstring_5x7(w, h, buf, xpos, ypos, 0xffff);
}

33
ui.c

@ -68,7 +68,7 @@ enum {
};
enum {
KM_START, KM_STOP, KM_CENTER, KM_SPAN, KM_CW, KM_SCALE, KM_REFPOS, KM_EDELAY
KM_START, KM_STOP, KM_CENTER, KM_SPAN, KM_CW, KM_SCALE, KM_REFPOS, KM_EDELAY, KM_VELOCITY_FACTOR
};
uint8_t ui_mode = UI_NORMAL;
@ -667,6 +667,7 @@ menu_channel_cb(int item)
static void
menu_tdr_cb(int item)
{
int status;
switch (item) {
case 0:
if ((domain_mode & DOMAIN_MODE) == DOMAIN_TIME) {
@ -674,16 +675,27 @@ menu_tdr_cb(int item)
} else {
domain_mode = (domain_mode & ~DOMAIN_MODE) | DOMAIN_TIME;
}
ui_mode_normal();
break;
case 1:
domain_mode = (domain_mode & ~TDR_FUNC) | TDR_FUNC_IMPULSE;
ui_mode_normal();
break;
case 2:
domain_mode = (domain_mode & ~TDR_FUNC) | TDR_FUNC_STEP;
ui_mode_normal();
break;
case 3:
status = btn_wait_release();
if (status & EVT_BUTTON_DOWN_LONG) {
ui_mode_numeric(KM_VELOCITY_FACTOR);
ui_process_numeric();
} else {
ui_mode_keypad(KM_VELOCITY_FACTOR);
ui_process_keypad();
}
break;
}
ui_mode_normal();
}
static void
@ -900,6 +912,7 @@ const menuitem_t menu_tdr[] = {
{ MT_CALLBACK, "TDR MODE", menu_tdr_cb },
{ MT_CALLBACK, "IMPULSE", menu_tdr_cb },
{ MT_CALLBACK, "STEP", menu_tdr_cb },
{ MT_CALLBACK, "\2VELOCITY\0FACTOR", menu_tdr_cb },
{ MT_CANCEL, S_LARROW" BACK", NULL },
{ MT_NONE, NULL, NULL } // sentinel
};
@ -1150,11 +1163,12 @@ const keypads_t * const keypads_mode_tbl[] = {
keypads_freq, // cw freq
keypads_scale, // scale
keypads_scale, // respos
keypads_time // electrical delay
keypads_time, // electrical delay
keypads_scale // velocity factor
};
const char * const keypad_mode_label[] = {
"START", "STOP", "CENTER", "SPAN", "CW FREQ", "SCALE", "REFPOS", "EDELAY"
"START", "STOP", "CENTER", "SPAN", "CW FREQ", "SCALE", "REFPOS", "EDELAY", "VELOCITY"
};
void
@ -1402,6 +1416,9 @@ fetch_numeric_target(void)
case KM_EDELAY:
uistat.value = get_electrical_delay();
break;
case KM_VELOCITY_FACTOR:
uistat.value = velocity_factor;
break;
}
{
@ -1441,6 +1458,9 @@ void set_numeric_value(void)
case KM_EDELAY:
set_electrical_delay(uistat.value);
break;
case KM_VELOCITY_FACTOR:
velocity_factor = uistat.value;
break;
}
}
@ -1615,6 +1635,9 @@ keypad_click(int key)
case KM_EDELAY:
set_electrical_delay(value); // pico seconds
break;
case KM_VELOCITY_FACTOR:
velocity_factor = value;
break;
}
return KP_DONE;

Loading…
Cancel
Save

Powered by TurnKey Linux.