From cdcfb6c18136c5436ecbdebf129bd6f4a91e970b Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Thu, 31 Jan 2013 01:21:56 -0300 Subject: [PATCH] ubb-la/gui.c: show division size (in samples and seconds) --- ubb-la/gui.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ubb-la/gui.c b/ubb-la/gui.c index c448471..b17c3d8 100644 --- a/ubb-la/gui.c +++ b/ubb-la/gui.c @@ -65,6 +65,10 @@ #define FREQ_Y 220 #define INTERVAL_X 0 #define INTERVAL_Y 230 +#define DIV_SAMP_X (80-8) +#define DIV_SAMP_Y FREQ_Y +#define DIV_INT_X 80 +#define DIV_INT_Y INTERVAL_Y #define REPEAT_DELAY_MS 300 #define REPEAT_INTERVAL_MS 30 @@ -340,10 +344,15 @@ static void si_text(int x, int y, double v, const char *unit) } -static void show_freq(double freq) +static void show_freq(double freq, int zoom) { + int div; + si_text(FREQ_X, FREQ_Y, freq, "Sa/s"); si_text(INTERVAL_X, INTERVAL_Y, 1/freq, "s/Sa"); + div = (DIV_X >> MAX_ZOOM) << (MAX_ZOOM-zoom); + textf(DIV_SAMP_X, DIV_SAMP_Y, TEXT_RGBA, "%4dSa/div", div); + si_text(DIV_INT_X, DIV_INT_Y, div/freq, "s/div"); } @@ -387,7 +396,7 @@ void gui(const uint8_t *buf, int skip, int nibbles, double freq) textf(0, ch_y(i, 1), LABEL_RGBA, "CH%d", i); show_divisions(); show_buffer(buf, skip, nibbles, CH_XOFF, XRES, zoom, pos); - show_freq(freq); + show_freq(freq, zoom); update(); while (1) {