1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-11-16 17:22:29 +02:00

ubb-la/gui.c (gui): move position display to show_position; add position in samples

This commit is contained in:
Werner Almesberger 2013-01-31 23:24:24 -03:00
parent f9b3c36c6b
commit 5b050b4b36

View File

@ -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) {