mirror of
https://github.com/ttrftech/NanoVNA.git
synced 2025-12-06 03:31:59 +01:00
define POINTS_COUNT in nanovna.h
fix 'micro' char in font fix draw STOP distance in frequency field fix x position calc in plot_into_index fix frequencies delta defined as int in plot.c fix frequencies defined as int in ui.c
This commit is contained in:
parent
4a0ba6741e
commit
5a4d02208f
24
Font5x7.c
24
Font5x7.c
|
|
@ -575,22 +575,22 @@ const uint8_t x5x7_bits[127*7] =
|
|||
0b10011000,
|
||||
|
||||
/* Character (0x1d):
|
||||
width=6
|
||||
width=7
|
||||
+--------+
|
||||
| |
|
||||
|* * |
|
||||
|* * |
|
||||
|* * |
|
||||
|** ** |
|
||||
|* * * |
|
||||
| |
|
||||
| * * |
|
||||
| * * |
|
||||
| ** ** |
|
||||
| * * * |
|
||||
|* |
|
||||
+--------+ */
|
||||
0b00000000|CHAR5x7_WIDTH_6px,
|
||||
0b10001000,
|
||||
0b10001000,
|
||||
0b11011000,
|
||||
0b10101000,
|
||||
0b10000000,
|
||||
0b00000000|CHAR5x7_WIDTH_7px,
|
||||
0b00000000,
|
||||
0b01000100,
|
||||
0b01000100,
|
||||
0b01101100,
|
||||
0b01010100,
|
||||
0b10000000,
|
||||
|
||||
/* Character (0x1e):
|
||||
|
|
|
|||
22
main.c
22
main.c
|
|
@ -156,18 +156,18 @@ transform_domain(void)
|
|||
// and calculate ifft for time domain
|
||||
float* tmp = (float*)spi_buffer;
|
||||
|
||||
uint8_t window_size = 101, offset = 0;
|
||||
uint8_t window_size = POINTS_COUNT, offset = 0;
|
||||
uint8_t is_lowpass = FALSE;
|
||||
switch (domain_mode & TD_FUNC) {
|
||||
case TD_FUNC_BANDPASS:
|
||||
offset = 0;
|
||||
window_size = 101;
|
||||
window_size = POINTS_COUNT;
|
||||
break;
|
||||
case TD_FUNC_LOWPASS_IMPULSE:
|
||||
case TD_FUNC_LOWPASS_STEP:
|
||||
is_lowpass = TRUE;
|
||||
offset = 101;
|
||||
window_size = 202;
|
||||
offset = POINTS_COUNT;
|
||||
window_size = POINTS_COUNT*2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -187,17 +187,17 @@ transform_domain(void)
|
|||
|
||||
for (int ch = 0; ch < 2; ch++) {
|
||||
memcpy(tmp, measured[ch], sizeof(measured[0]));
|
||||
for (int i = 0; i < 101; i++) {
|
||||
for (int i = 0; i < POINTS_COUNT; i++) {
|
||||
float w = kaiser_window(i+offset, window_size, beta);
|
||||
tmp[i*2+0] *= w;
|
||||
tmp[i*2+1] *= w;
|
||||
}
|
||||
for (int i = 101; i < FFT_SIZE; i++) {
|
||||
for (int i = POINTS_COUNT; i < FFT_SIZE; i++) {
|
||||
tmp[i*2+0] = 0.0;
|
||||
tmp[i*2+1] = 0.0;
|
||||
}
|
||||
if (is_lowpass) {
|
||||
for (int i = 1; i < 101; i++) {
|
||||
for (int i = 1; i < POINTS_COUNT; i++) {
|
||||
tmp[(FFT_SIZE-i)*2+0] = tmp[i*2+0];
|
||||
tmp[(FFT_SIZE-i)*2+1] = -tmp[i*2+1];
|
||||
}
|
||||
|
|
@ -205,7 +205,7 @@ transform_domain(void)
|
|||
|
||||
fft256_inverse((float(*)[2])tmp);
|
||||
memcpy(measured[ch], tmp, sizeof(measured[0]));
|
||||
for (int i = 0; i < 101; i++) {
|
||||
for (int i = 0; i < POINTS_COUNT; i++) {
|
||||
measured[ch][i][0] /= (float)FFT_SIZE;
|
||||
if (is_lowpass) {
|
||||
measured[ch][i][1] = 0.0;
|
||||
|
|
@ -214,7 +214,7 @@ transform_domain(void)
|
|||
}
|
||||
}
|
||||
if ( (domain_mode & TD_FUNC) == TD_FUNC_LOWPASS_STEP ) {
|
||||
for (int i = 1; i < 101; i++) {
|
||||
for (int i = 1; i < POINTS_COUNT; i++) {
|
||||
measured[ch][i][0] += measured[ch][i-1][0];
|
||||
}
|
||||
}
|
||||
|
|
@ -420,7 +420,7 @@ int16_t dump_selection = 0;
|
|||
|
||||
volatile int16_t wait_count = 0;
|
||||
|
||||
float measured[2][101][2];
|
||||
float measured[2][POINTS_COUNT][2];
|
||||
|
||||
static void
|
||||
wait_dsp(int count)
|
||||
|
|
@ -605,7 +605,7 @@ properties_t current_props = {
|
|||
.magic = CONFIG_MAGIC,
|
||||
._frequency0 = 50000, // start = 50kHz
|
||||
._frequency1 = 900000000, // end = 900MHz
|
||||
._sweep_points = 101,
|
||||
._sweep_points = POINTS_COUNT,
|
||||
._trace = {/*enable, type, channel, polar, scale, refpos*/
|
||||
{ 1, TRC_LOGMAG, 0, 0, 1.0, 9.0 },
|
||||
{ 1, TRC_LOGMAG, 1, 0, 1.0, 9.0 },
|
||||
|
|
|
|||
22
nanovna.h
22
nanovna.h
|
|
@ -26,7 +26,8 @@
|
|||
* main.c
|
||||
*/
|
||||
|
||||
extern float measured[2][101][2];
|
||||
#define POINTS_COUNT 101
|
||||
extern float measured[2][POINTS_COUNT][2];
|
||||
|
||||
#define CAL_LOAD 0
|
||||
#define CAL_OPEN 1
|
||||
|
|
@ -225,7 +226,7 @@ void draw_battery_status(void);
|
|||
|
||||
void set_electrical_delay(float picoseconds);
|
||||
float get_electrical_delay(void);
|
||||
float groupdelay_from_array(int i, float array[101][2]);
|
||||
float groupdelay_from_array(int i, float array[POINTS_COUNT][2]);
|
||||
|
||||
// marker
|
||||
|
||||
|
|
@ -249,7 +250,7 @@ void request_to_draw_cells_behind_menu(void);
|
|||
void request_to_draw_cells_behind_numeric_input(void);
|
||||
void redraw_marker(int marker, int update_info);
|
||||
void trace_get_info(int t, char *buf, int len);
|
||||
void plot_into_index(float measured[2][101][2]);
|
||||
void plot_into_index(float measured[2][POINTS_COUNT][2]);
|
||||
void force_set_markmap(void);
|
||||
void draw_frequencies(void);
|
||||
void draw_all(bool flush);
|
||||
|
|
@ -288,10 +289,13 @@ extern int16_t vbat;
|
|||
#define DEFAULT_MENU_COLOR RGB565(255,255,255)
|
||||
#define DEFAULT_MENU_TEXT_COLOR RGB565( 0, 0, 0)
|
||||
#define DEFAULT_MENU_ACTIVE_COLOR RGB565(180,255,180)
|
||||
#define DEFAULT_TRACE_1_COLOR RGB565( 0,255,255)
|
||||
#define DEFAULT_TRACE_2_COLOR RGB565(255, 0, 40)
|
||||
#define DEFAULT_TRACE_3_COLOR RGB565( 0, 0,255)
|
||||
#define DEFAULT_TRACE_4_COLOR RGB565( 50,255, 0)
|
||||
#define DEFAULT_TRACE_1_COLOR RGB565(255,200, 14)
|
||||
#define DEFAULT_TRACE_2_COLOR RGB565( 0,191,231)
|
||||
#define DEFAULT_TRACE_3_COLOR RGB565( 64,255, 0)
|
||||
#define DEFAULT_TRACE_4_COLOR RGB565(255,160,100)
|
||||
#define DEFAULT_NORMAL_BAT_COLOR RGB565( 31,227, 0)
|
||||
#define DEFAULT_LOW_BAT_COLOR RGB565(255, 0, 0)
|
||||
#define DEFAULT_SPEC_INPUT_COLOR RGB565(128,255,128);
|
||||
|
||||
extern uint16_t foreground_color;
|
||||
extern uint16_t background_color;
|
||||
|
|
@ -330,8 +334,8 @@ typedef struct {
|
|||
int16_t _sweep_points;
|
||||
uint16_t _cal_status;
|
||||
|
||||
uint32_t _frequencies[101];
|
||||
float _cal_data[5][101][2];
|
||||
uint32_t _frequencies[POINTS_COUNT];
|
||||
float _cal_data[5][POINTS_COUNT][2];
|
||||
float _electrical_delay; // picoseconds
|
||||
|
||||
trace_t _trace[TRACES_MAX];
|
||||
|
|
|
|||
61
plot.c
61
plot.c
|
|
@ -42,7 +42,7 @@ int area_height = HEIGHT+1;
|
|||
* CELL_X[5:9] position in the cell
|
||||
* CELL_Y[0:4]
|
||||
*/
|
||||
uint32_t trace_index[TRACES_MAX][101];
|
||||
uint32_t trace_index[TRACES_MAX][POINTS_COUNT];
|
||||
|
||||
#define INDEX(x, y, n) \
|
||||
((((x)&0x03e0UL)<<22) | (((y)&0x03e0UL)<<17) | (((n)&0x0fffUL)<<10) \
|
||||
|
|
@ -66,10 +66,10 @@ int floatToInt(float v){
|
|||
|
||||
void update_grid(void)
|
||||
{
|
||||
int32_t gdigit = 100000000;
|
||||
int32_t fstart, fspan;
|
||||
int32_t grid;
|
||||
if (frequency0 < frequency1) {
|
||||
uint32_t gdigit = 100000000;
|
||||
uint32_t fstart, fspan;
|
||||
uint32_t grid;
|
||||
if (frequency0 <= frequency1) {
|
||||
fstart = frequency0;
|
||||
fspan = frequency1 - frequency0;
|
||||
} else {
|
||||
|
|
@ -498,7 +498,7 @@ cartesian_scale(float re, float im, int *xp, int *yp, float scale)
|
|||
}
|
||||
|
||||
float
|
||||
groupdelay_from_array(int i, float array[101][2])
|
||||
groupdelay_from_array(int i, float array[POINTS_COUNT][2])
|
||||
{
|
||||
/*
|
||||
if (i == 0) {
|
||||
|
|
@ -513,13 +513,13 @@ groupdelay_from_array(int i, float array[101][2])
|
|||
}
|
||||
*/
|
||||
int bottom = (i == 0) ? 0 : i - 1;
|
||||
int top = (i == 100) ? 100 : i + 1;
|
||||
int top = (i == POINTS_COUNT-1) ? POINTS_COUNT-1 : i + 1;
|
||||
float deltaf = frequencies[top] - frequencies[bottom];
|
||||
return groupdelay(array[bottom], array[top], deltaf);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
trace_into_index(int x, int t, int i, float array[101][2])
|
||||
trace_into_index(int x, int t, int i, float array[POINTS_COUNT][2])
|
||||
{
|
||||
int y = 0;
|
||||
float v = 0;
|
||||
|
|
@ -626,7 +626,6 @@ string_value_with_prefix(char *buf, int len, float val, char unit)
|
|||
return n;
|
||||
}
|
||||
|
||||
|
||||
#define PI2 6.283184
|
||||
|
||||
static void
|
||||
|
|
@ -704,7 +703,7 @@ gamma2reactance(char *buf, int len, const float coeff[2])
|
|||
}
|
||||
|
||||
static void
|
||||
trace_get_value_string(int t, char *buf, int len, float array[101][2], int i)
|
||||
trace_get_value_string(int t, char *buf, int len, float array[POINTS_COUNT][2], int i)
|
||||
{
|
||||
float *coeff = array[i];
|
||||
float v;
|
||||
|
|
@ -758,7 +757,7 @@ trace_get_value_string(int t, char *buf, int len, float array[101][2], int i)
|
|||
}
|
||||
|
||||
static void
|
||||
trace_get_value_string_delta(int t, char *buf, int len, float array[101][2], int index, int index_ref)
|
||||
trace_get_value_string_delta(int t, char *buf, int len, float array[POINTS_COUNT][2], int index, int index_ref)
|
||||
{
|
||||
float *coeff = array[index];
|
||||
float *coeff_ref = array[index_ref];
|
||||
|
|
@ -928,11 +927,11 @@ mark_cells_from_index(void)
|
|||
}
|
||||
}
|
||||
|
||||
void plot_into_index(float measured[2][101][2])
|
||||
void plot_into_index(float measured[2][POINTS_COUNT][2])
|
||||
{
|
||||
int i, t;
|
||||
for (i = 0; i < sweep_points; i++) {
|
||||
int x = i * (WIDTH-1) / (sweep_points-1);
|
||||
int x = (i * (WIDTH-1) + sweep_points/2) / (sweep_points-1);
|
||||
for (t = 0; t < TRACES_MAX; t++) {
|
||||
if (!trace[t].enabled)
|
||||
continue;
|
||||
|
|
@ -1026,7 +1025,7 @@ cell_drawline(int w, int h, int x0, int y0, int x1, int y1, int c)
|
|||
}
|
||||
|
||||
int
|
||||
search_index_range(int x, int y, uint32_t index[101], int *i0, int *i1)
|
||||
search_index_range(int x, int y, uint32_t index[POINTS_COUNT], int *i0, int *i1)
|
||||
{
|
||||
int i, j;
|
||||
int head = 0;
|
||||
|
|
@ -1056,14 +1055,14 @@ search_index_range(int x, int y, uint32_t index[101], int *i0, int *i1)
|
|||
j--;
|
||||
*i0 = j;
|
||||
j = i;
|
||||
while (j < 100 && x == CELL_X0(index[j+1]) && y == CELL_Y0(index[j+1]))
|
||||
while (j < POINTS_COUNT-1 && x == CELL_X0(index[j+1]) && y == CELL_Y0(index[j+1]))
|
||||
j++;
|
||||
*i1 = j;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int
|
||||
search_index_range_x(int x, uint32_t index[101], int *i0, int *i1)
|
||||
search_index_range_x(int x, uint32_t index[POINTS_COUNT], int *i0, int *i1)
|
||||
{
|
||||
int i, j;
|
||||
int head = 0;
|
||||
|
|
@ -1093,7 +1092,7 @@ search_index_range_x(int x, uint32_t index[101], int *i0, int *i1)
|
|||
j--;
|
||||
*i0 = j;
|
||||
j = i;
|
||||
while (j < 100 && x == CELL_X0(index[j+1]))
|
||||
while (j < POINTS_COUNT-1 && x == CELL_X0(index[j+1]))
|
||||
j++;
|
||||
*i1 = j;
|
||||
return TRUE;
|
||||
|
|
@ -1238,7 +1237,7 @@ marker_search(void)
|
|||
return -1;
|
||||
|
||||
int value = CELL_Y(trace_index[uistat.current_trace][0]);
|
||||
for (i = 0; i < 101; i++) {
|
||||
for (i = 0; i < POINTS_COUNT; i++) {
|
||||
uint32_t index = trace_index[uistat.current_trace][i];
|
||||
if ((*compare)(value, CELL_Y(index))) {
|
||||
value = CELL_Y(index);
|
||||
|
|
@ -1296,14 +1295,14 @@ marker_search_right(int from)
|
|||
return -1;
|
||||
|
||||
int value = CELL_Y(trace_index[uistat.current_trace][from]);
|
||||
for (i = from + 1; i < 101; i++) {
|
||||
for (i = from + 1; i < POINTS_COUNT; i++) {
|
||||
uint32_t index = trace_index[uistat.current_trace][i];
|
||||
if ((*compare)(value, CELL_Y(index)))
|
||||
break;
|
||||
value = CELL_Y(index);
|
||||
}
|
||||
|
||||
for (; i < 101; i++) {
|
||||
for (; i < POINTS_COUNT; i++) {
|
||||
uint32_t index = trace_index[uistat.current_trace][i];
|
||||
if ((*compare)(CELL_Y(index), value)) {
|
||||
break;
|
||||
|
|
@ -1482,7 +1481,7 @@ draw_cell(int m, int n)
|
|||
if (search_index_range_x(x0, trace_index[t], &i0, &i1)) {
|
||||
if (i0 > 0)
|
||||
i0--;
|
||||
if (i1 < 101-1)
|
||||
if (i1 < POINTS_COUNT-1)
|
||||
i1++;
|
||||
for (i = i0; i < i1; i++) {
|
||||
int x1 = CELL_X(trace_index[t][i]);
|
||||
|
|
@ -1665,10 +1664,10 @@ cell_draw_marker_info(int m, int n, int w, int h)
|
|||
if (mk == active_marker)
|
||||
cell_drawstring(w, h, S_SARROW, xpos, ypos);
|
||||
xpos += 5;
|
||||
chsnprintf(buf, sizeof buf, "MK%d", mk);
|
||||
chsnprintf(buf, sizeof buf, "M%d", mk+1);
|
||||
cell_drawstring(w, h, buf, xpos, ypos);
|
||||
|
||||
xpos += 19;
|
||||
xpos += 13;
|
||||
//trace_get_info(t, buf, sizeof buf);
|
||||
int32_t freq = frequencies[markers[mk].index];
|
||||
if (uistat.marker_delta && mk != active_marker) {
|
||||
|
|
@ -1691,7 +1690,7 @@ cell_draw_marker_info(int m, int n, int w, int h)
|
|||
// draw marker delta
|
||||
if (!uistat.marker_delta && previous_marker >= 0 && active_marker != previous_marker && markers[previous_marker].enabled) {
|
||||
int idx0 = markers[previous_marker].index;
|
||||
int xpos = 192;
|
||||
int xpos = 185;
|
||||
int ypos = 1 + (j/2)*8;
|
||||
xpos -= m * CELLWIDTH -CELLOFFSETX;
|
||||
ypos -= n * CELLHEIGHT;
|
||||
|
|
@ -1701,7 +1700,8 @@ cell_draw_marker_info(int m, int n, int w, int h)
|
|||
cell_drawstring(w, h, buf, xpos, ypos);
|
||||
xpos += 19;
|
||||
if ((domain_mode & DOMAIN_MODE) == DOMAIN_FREQ) {
|
||||
frequency_string(buf, sizeof buf, frequencies[idx] - frequencies[idx0], "");
|
||||
uint32_t delta = frequencies[idx] > frequencies[idx0] ? frequencies[idx]-frequencies[idx0] : frequencies[idx0]-frequencies[idx];
|
||||
frequency_string(buf, sizeof buf, delta, "");
|
||||
} else {
|
||||
//chsnprintf(buf, sizeof buf, "%d ns %.1f m", (uint16_t)(time_of_index(idx) * 1e9 - time_of_index(idx0) * 1e9),
|
||||
// distance_of_index(idx) - distance_of_index(idx0));
|
||||
|
|
@ -1742,10 +1742,11 @@ cell_draw_marker_info(int m, int n, int w, int h)
|
|||
}
|
||||
|
||||
// draw marker frequency
|
||||
int xpos = 192;
|
||||
int xpos = 185;
|
||||
int ypos = 1 + (j/2)*8;
|
||||
xpos -= m * CELLWIDTH -CELLOFFSETX;
|
||||
ypos -= n * CELLHEIGHT;
|
||||
setForegroundColor(DEFAULT_FG_COLOR);
|
||||
// strcpy(buf, "1:");
|
||||
// buf[0] += active_marker;
|
||||
// xpos += 5;
|
||||
|
|
@ -1755,7 +1756,7 @@ cell_draw_marker_info(int m, int n, int w, int h)
|
|||
if (uistat.lever_mode == LM_MARKER)
|
||||
cell_drawstring(w, h, S_SARROW, xpos, ypos);
|
||||
xpos += 5;
|
||||
chsnprintf(buf, sizeof buf, "1:%d", active_marker);
|
||||
chsnprintf(buf, sizeof buf, "M%d:", active_marker+1);
|
||||
cell_drawstring(w, h, buf, xpos, ypos);
|
||||
xpos += 19;
|
||||
|
||||
|
|
@ -1854,8 +1855,8 @@ draw_frequencies(void)
|
|||
}
|
||||
|
||||
} else {
|
||||
chsnprintf(buf1, sizeof buf1, "START 0s");
|
||||
chsnprintf(buf2, sizeof buf2, "%s%d ns", "STOP ", (uint16_t)(time_of_index(101) * 1e9));
|
||||
chsnprintf(buf1+1, sizeof(buf1)-1, "START 0s");
|
||||
chsnprintf(buf2, sizeof buf2, "%s%dns (%.2fm)", "STOP ", (uint16_t)(time_of_index(POINTS_COUNT-1) * 1e9), distance_of_index(POINTS_COUNT-1));
|
||||
}
|
||||
setForegroundColor(DEFAULT_FG_COLOR);
|
||||
setBackgroundColor(DEFAULT_BG_COLOR);
|
||||
|
|
@ -1919,7 +1920,7 @@ draw_battery_status(void)
|
|||
{
|
||||
uint8_t string_buf[25];
|
||||
// Set battery color
|
||||
setForegroundColor(vbat < BATTERY_WARNING_LEVEL ? RGBHEX(0xff0000) : RGBHEX(0x1fe300));
|
||||
setForegroundColor(vbat < BATTERY_WARNING_LEVEL ? DEFAULT_LOW_BAT_COLOR : DEFAULT_NORMAL_BAT_COLOR);
|
||||
setBackgroundColor(DEFAULT_BG_COLOR);
|
||||
// chsnprintf(string_buf, sizeof string_buf, "V:%d", vbat);
|
||||
// ili9341_drawstringV(string_buf, 1, 60);
|
||||
|
|
|
|||
77
ui.c
77
ui.c
|
|
@ -515,27 +515,27 @@ menu_config_cb(int item, uint8_t data)
|
|||
switch (item) {
|
||||
case 0:
|
||||
touch_cal_exec();
|
||||
redraw_frame();
|
||||
request_to_redraw_grid();
|
||||
draw_menu();
|
||||
break;
|
||||
case 1:
|
||||
touch_draw_test();
|
||||
redraw_frame();
|
||||
request_to_redraw_grid();
|
||||
draw_menu();
|
||||
break;
|
||||
case 2:
|
||||
config_save();
|
||||
menu_move_back();
|
||||
ui_mode_normal();
|
||||
break;
|
||||
case 3:
|
||||
show_version();
|
||||
redraw_frame();
|
||||
request_to_redraw_grid();
|
||||
draw_menu();
|
||||
break;
|
||||
}
|
||||
redraw_frame();
|
||||
request_to_redraw_grid();
|
||||
draw_menu();
|
||||
}
|
||||
|
||||
static void
|
||||
menu_config_save_cb(int item, uint8_t data)
|
||||
{
|
||||
(void)item;
|
||||
(void)data;
|
||||
config_save();
|
||||
menu_move_back();
|
||||
ui_mode_normal();
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -712,46 +712,40 @@ menu_stimulus_cb(int item, uint8_t data)
|
|||
}
|
||||
|
||||
|
||||
static int32_t
|
||||
static uint32_t
|
||||
get_marker_frequency(int marker)
|
||||
{
|
||||
if (marker < 0 || marker >= 4)
|
||||
return -1;
|
||||
return 0;
|
||||
if (!markers[marker].enabled)
|
||||
return -1;
|
||||
return 0;
|
||||
return frequencies[markers[marker].index];
|
||||
}
|
||||
|
||||
static void
|
||||
menu_marker_op_cb(int item, uint8_t data)
|
||||
{
|
||||
(void)data;
|
||||
int32_t freq = get_marker_frequency(active_marker);
|
||||
if (freq < 0)
|
||||
uint32_t freq = get_marker_frequency(active_marker);
|
||||
if (freq == 0)
|
||||
return; // no active marker
|
||||
|
||||
switch (item) {
|
||||
case 0: /* MARKER->START */
|
||||
set_sweep_frequency(ST_START, freq);
|
||||
break;
|
||||
case 1: /* MARKER->STOP */
|
||||
set_sweep_frequency(ST_STOP, freq);
|
||||
break;
|
||||
case 2: /* MARKER->CENTER */
|
||||
set_sweep_frequency(ST_CENTER, freq);
|
||||
set_sweep_frequency(data, freq);
|
||||
break;
|
||||
case 3: /* MARKERS->SPAN */
|
||||
{
|
||||
if (previous_marker == -1 || active_marker == previous_marker) {
|
||||
// if only 1 marker is active, keep center freq and make span the marker comes to the edge
|
||||
int32_t center = get_sweep_frequency(ST_CENTER);
|
||||
int32_t span = center - freq;
|
||||
if (span < 0) span = -span;
|
||||
// if only 1 marker is active, keep center freq and make span the marker comes to the edge
|
||||
uint32_t center = get_sweep_frequency(ST_CENTER);
|
||||
uint32_t span = center > freq ? center - freq : freq - center;
|
||||
set_sweep_frequency(ST_SPAN, span * 2);
|
||||
} else {
|
||||
// if 2 or more marker active, set start and stop freq to each marker
|
||||
int32_t freq2 = get_marker_frequency(previous_marker);
|
||||
if (freq2 < 0)
|
||||
uint32_t freq2 = get_marker_frequency(previous_marker);
|
||||
if (freq2 == 0)
|
||||
return;
|
||||
if (freq > freq2) {
|
||||
freq2 = freq;
|
||||
|
|
@ -792,25 +786,22 @@ menu_marker_search_cb(int item, uint8_t data)
|
|||
i = marker_search();
|
||||
if (i != -1)
|
||||
markers[active_marker].index = i;
|
||||
draw_menu();
|
||||
break;
|
||||
case 2: /* search Left */
|
||||
i = marker_search_left(markers[active_marker].index);
|
||||
if (i != -1)
|
||||
markers[active_marker].index = i;
|
||||
draw_menu();
|
||||
break;
|
||||
case 3: /* search right */
|
||||
i = marker_search_right(markers[active_marker].index);
|
||||
if (i != -1)
|
||||
markers[active_marker].index = i;
|
||||
draw_menu();
|
||||
break;
|
||||
case 4: /* tracking */
|
||||
marker_tracking = !marker_tracking;
|
||||
draw_menu();
|
||||
break;
|
||||
}
|
||||
draw_menu();
|
||||
redraw_marker(active_marker, TRUE);
|
||||
uistat.lever_mode = LM_SEARCH;
|
||||
}
|
||||
|
|
@ -943,7 +934,6 @@ const menuitem_t menu_scale[] = {
|
|||
{ MT_NONE, 0, NULL, NULL } // sentinel
|
||||
};
|
||||
|
||||
|
||||
const menuitem_t menu_channel[] = {
|
||||
{ MT_CALLBACK, 0, "\2CH0\0REFLECT", menu_channel_cb },
|
||||
{ MT_CALLBACK, 1, "\2CH1\0THROUGH", menu_channel_cb },
|
||||
|
|
@ -1003,10 +993,10 @@ const menuitem_t menu_marker_sel[] = {
|
|||
};
|
||||
|
||||
const menuitem_t menu_marker_ops[] = {
|
||||
{ MT_CALLBACK, 0, S_RARROW"START", menu_marker_op_cb },
|
||||
{ MT_CALLBACK, 0, S_RARROW"STOP", menu_marker_op_cb },
|
||||
{ MT_CALLBACK, 0, S_RARROW"CENTER", menu_marker_op_cb },
|
||||
{ MT_CALLBACK, 0, S_RARROW"SPAN", menu_marker_op_cb },
|
||||
{ MT_CALLBACK, ST_START, S_RARROW"START", menu_marker_op_cb },
|
||||
{ MT_CALLBACK, ST_STOP, S_RARROW"STOP", menu_marker_op_cb },
|
||||
{ MT_CALLBACK, ST_CENTER, S_RARROW"CENTER", menu_marker_op_cb },
|
||||
{ MT_CALLBACK, ST_SPAN, S_RARROW"SPAN", menu_marker_op_cb },
|
||||
{ MT_CALLBACK, 0, S_RARROW"EDELAY", menu_marker_op_cb },
|
||||
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
|
||||
{ MT_NONE, 0, NULL, NULL } // sentinel
|
||||
|
|
@ -1061,7 +1051,7 @@ const menuitem_t menu_dfu[] = {
|
|||
const menuitem_t menu_config[] = {
|
||||
{ MT_CALLBACK, 0, "TOUCH CAL", menu_config_cb },
|
||||
{ MT_CALLBACK, 0, "TOUCH TEST", menu_config_cb },
|
||||
{ MT_CALLBACK, 0, "SAVE", menu_config_cb },
|
||||
{ MT_CALLBACK, 0, "SAVE", menu_config_save_cb },
|
||||
{ MT_CALLBACK, 0, "VERSION", menu_config_cb },
|
||||
{ MT_SUBMENU, 0, S_RARROW"DFU", menu_dfu },
|
||||
{ MT_CANCEL, 0, S_LARROW" BACK", NULL },
|
||||
|
|
@ -1174,10 +1164,13 @@ void menu_invoke(int item)
|
|||
#define KP_N 21
|
||||
#define KP_P 22
|
||||
|
||||
// Set struct data align as BYTE for save flash memory
|
||||
#pragma pack(push, 1)
|
||||
typedef struct {
|
||||
uint16_t x, y;
|
||||
int8_t c;
|
||||
} keypads_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
const keypads_t *keypads;
|
||||
uint8_t keypads_last_index;
|
||||
|
|
@ -1303,7 +1296,7 @@ draw_numeric_input(const char *buf)
|
|||
c = -1;
|
||||
|
||||
if (uistat.digit == 8-i) {
|
||||
fg = RGB565(128,255,128);
|
||||
fg = DEFAULT_SPEC_INPUT_COLOR;
|
||||
focused = TRUE;
|
||||
if (uistat.digit_mode)
|
||||
bg = DEFAULT_MENU_COLOR;
|
||||
|
|
|
|||
Loading…
Reference in a new issue