diff --git a/ubb-la/gui.c b/ubb-la/gui.c index a0ca7f6..6593b06 100644 --- a/ubb-la/gui.c +++ b/ubb-la/gui.c @@ -74,7 +74,8 @@ #define UNIT_GAP 2 /* space between number and unit */ -#define POS_X 168 +#define POS_T_X 176 +#define POS_SAMP_X 264 #define POS_Y (MEAS_DIV_Y-8-3) #define MEAS_DIV_Y (FREQ_Y-3-1) @@ -339,7 +340,7 @@ static void show_buffer(const uint8_t *buf, int skip, int nibbles, } -/* ----- Display the sample frequency -------------------------------------- */ +/* ----- Display various settings ------------------------------------------ */ static void si_text(int x, int y, double v, const char *unit, int digits) @@ -391,7 +392,19 @@ static void show_freq(double freq, int zoom) } -/* ----- Show a divisions -------------------------------------------------- */ +static void show_position(double freq, int pos) +{ + si_text(POS_T_X, POS_Y, pos/freq, "s", 7); + hlineColor(surf, 0, XRES-1, MEAS_DIV_Y, DIV_RGBA); + si_text(POS_T_X, POS_Y, pos/freq, "s", 7); + hlineColor(surf, 0, XRES-1, MEAS_DIV_Y, DIV_RGBA); + + textf(POS_SAMP_X, POS_Y, TEXT_RGBA, "%4d", pos); + textf(POS_SAMP_X+4*8+UNIT_GAP, POS_Y, UNIT_RGBA, "Sa", div); +} + + +/* ----- Show divisions ---------------------------------------------------- */ static void show_divisions(void) @@ -436,8 +449,7 @@ void gui(const uint8_t *buf, int skip, int nibbles, double freq) XCENTER+CENTER_W/2, CENTER_Y0, CENTER_RGBA); show_buffer(buf, skip, nibbles, CH_XOFF, XRES, zoom, pos); show_freq(freq, zoom); - si_text(POS_X, POS_Y, pos/freq, "s", 7); - hlineColor(surf, 0, XRES-1, MEAS_DIV_Y, DIV_RGBA); + show_position(freq, pos); update(); while (1) {