remove fstart/fstop

This commit is contained in:
TT 2016-12-12 23:45:49 +09:00
parent aa91bc23fc
commit 6d0ea0e1dd
4 changed files with 24 additions and 26 deletions

6
main.c
View file

@ -374,6 +374,7 @@ ensure_edit_config(void)
//memcpy(&current_config, active, sizeof(config_t));
active = &current_config;
// move to uncal state
cal_status = 0;
}
@ -459,15 +460,16 @@ update_frequencies(void)
start = freq_start;
span = (freq_stop - freq_start)/100;
} else {
span = -freq_stop / 100;
span = -freq_stop;
start = freq_start - span/2;
span /= 100;
}
for (i = 0; i < sweep_points; i++)
frequencies[i] = start + span * i / (sweep_points - 1) * 100;
// set grid layout
set_sweep(freq_start, freq_stop);
update_grid();
}

View file

@ -150,7 +150,7 @@ typedef struct {
//extern int active_marker;
void plot_init(void);
void set_sweep(int32_t start, int stop);
void update_grid(void);
void redraw(void);
void force_draw_cells(void);
void redraw_marker(int marker, int update_info);

40
plot.c
View file

@ -63,25 +63,21 @@ int active_marker = 0;
#endif
int32_t fstart = 0;
int32_t fstop = 300000000;
int32_t fspan = 300000000;
int32_t fgrid = 50000000;
int16_t grid_offset;
int16_t grid_width;
void set_sweep(int32_t start, int stop)
void update_grid(void)
{
int32_t gdigit = 100000000;
int32_t fstart, fspan;
int32_t grid;
if (stop > 0) {
fstart = start;
fstop = stop;
fspan = stop - start;
if (freq_stop > 0) {
fstart = freq_start;
fspan = freq_stop - freq_start;
} else {
fspan = -stop;
fstart = start;
fstop = stop;
fspan = -freq_stop;
fstart = freq_start - fspan/2;
}
while (gdigit > 100) {
@ -1240,20 +1236,20 @@ void
draw_frequencies(void)
{
char buf[24];
if (fstop > 0) {
if (freq_stop > 0) {
chsnprintf(buf, 24, "START %d.%03d %03d MHz ",
(int)(fstart / 1000000),
(int)((fstart / 1000) % 1000),
(int)(fstart % 1000));
(int)(freq_start / 1000000),
(int)((freq_start / 1000) % 1000),
(int)(freq_start % 1000));
ili9341_drawstring_5x7(buf, OFFSETX, 233, 0xffff, 0x0000);
chsnprintf(buf, 24, "STOP %d.%03d %03d MHz",
(int)(fstop / 1000000),
(int)((fstop / 1000) % 1000),
(int)(fstop % 1000));
(int)(freq_stop / 1000000),
(int)((freq_stop / 1000) % 1000),
(int)(freq_stop % 1000));
ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000);
} else if (fstop < 0) {
int fcenter = fstart;
int fspan = -fstop;
} else if (freq_stop < 0) {
int fcenter = freq_start;
int fspan = -freq_stop;
chsnprintf(buf, 24, "CENTER %d.%03d %03d MHz ",
(int)(fcenter / 1000000),
(int)((fcenter / 1000) % 1000),
@ -1265,7 +1261,7 @@ draw_frequencies(void)
(int)(fspan % 1000));
ili9341_drawstring_5x7(buf, 205, 233, 0xffff, 0x0000);
} else {
int fcenter = fstart;
int fcenter = freq_start;
chsnprintf(buf, 24, "CW %d.%03d %03d MHz ",
(int)(fcenter / 1000000),
(int)((fcenter / 1000) % 1000),

2
ui.c
View file

@ -227,7 +227,7 @@ menu_recall_cb(int item)
return;
if (caldata_recall(item) == 0) {
ui_mode_normal();
set_sweep(freq_start, freq_stop);
update_grid();
draw_cal_status();
}
}