Time grid added and time resolution updated

tinySA-v0.2
erikkaashoek 6 years ago
parent 9d6f5dbb6f
commit a5dff1a84a

@ -116,6 +116,11 @@ void update_grid(void)
uint32_t fspan = get_sweep_frequency(ST_SPAN); uint32_t fspan = get_sweep_frequency(ST_SPAN);
uint32_t grid; uint32_t grid;
if (fspan == 0) {
fspan = setting.sweep_time*1000000 + 25000; // Time in uS
fstart = 0;
}
while (gdigit > 100) { while (gdigit > 100) {
grid = 5 * gdigit; grid = 5 * gdigit;
if (fspan / grid >= 4) if (fspan / grid >= 4)
@ -865,21 +870,21 @@ static void trace_get_value_string(
if (FREQ_IS_CW()) { if (FREQ_IS_CW()) {
float t = ii*(setting.sweep_time*1000000 + 25000)/290; float t = ii*(setting.sweep_time*1000000 + 25000)/290;
if (t>1000000.0){ if (t>1000000.0){
plot_printf(&buf2[1], sizeof(buf2) -1, "%5f" , t/1000000.0); plot_printf(&buf2[1], sizeof(buf2) -1, "%4f" , t/1000000.0);
buf2[6] = 'S'; buf2[5] = 'S';
buf2[7]=0; buf2[6]=0;
} }
else if (t>1000.0) { else if (t>1000.0) {
plot_printf(&buf2[1], sizeof(buf2) -1, "%5f" , t/1000.0); plot_printf(&buf2[1], sizeof(buf2) -1, "%4f" , t/1000.0);
buf2[6] = 'm'; buf2[5] = 'm';
buf2[7] = 'S'; buf2[6] = 'S';
buf2[8]=0; buf2[7]=0;
} }
else { else {
plot_printf(&buf2[1], sizeof(buf2) -1, "%5f" , t); plot_printf(&buf2[1], sizeof(buf2) -1, "%4f" , t);
buf2[6] = 'u'; buf2[5] = 'u';
buf2[7] = 'S'; buf2[6] = 'S';
buf2[8]=0; buf2[7]=0;
} }
} else { } else {
uint32_t resolution = get_sweep_frequency(ST_SPAN)/290; uint32_t resolution = get_sweep_frequency(ST_SPAN)/290;

@ -1934,12 +1934,14 @@ void draw_cal_status(void)
#endif #endif
; // in mS ; // in mS
if (t>=10000.0) if (t>=10000.0)
plot_printf(buf, BLEN, "%5dS",(int)t); plot_printf(buf, BLEN, "%5d",(int)(t/1000));
else if (t>=1000) else if (t>=1000)
plot_printf(buf, BLEN, "%5fS",t); plot_printf(buf, BLEN, "%5f",t/1000.0);
else else {
plot_printf(buf, BLEN, "%dmS",(int)t); plot_printf(buf, BLEN, "%4dm",(int)t);
buf[4] = 'm';
}
buf[5]='S';
buf[6]=0; buf[6]=0;
ili9341_drawstring(buf, x, y); ili9341_drawstring(buf, x, y);

@ -1850,6 +1850,7 @@ set_numeric_value(void)
break; break;
case KM_SWEEP_TIME: case KM_SWEEP_TIME:
set_sweep_time(uistat.value); set_sweep_time(uistat.value);
update_grid();
break; break;
case KM_TRIGGER: case KM_TRIGGER:
set_trigger_level(to_dBm(uistat.value)); set_trigger_level(to_dBm(uistat.value));

Loading…
Cancel
Save

Powered by TurnKey Linux.