mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2025-02-15 15:41:56 +02:00
ubb-la/gui.c (gui): move position display to show_position; add position in samples
This commit is contained in:
parent
f9b3c36c6b
commit
5b050b4b36
22
ubb-la/gui.c
22
ubb-la/gui.c
@ -74,7 +74,8 @@
|
|||||||
|
|
||||||
#define UNIT_GAP 2 /* space between number and unit */
|
#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 POS_Y (MEAS_DIV_Y-8-3)
|
||||||
|
|
||||||
#define MEAS_DIV_Y (FREQ_Y-3-1)
|
#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)
|
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)
|
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);
|
XCENTER+CENTER_W/2, CENTER_Y0, CENTER_RGBA);
|
||||||
show_buffer(buf, skip, nibbles, CH_XOFF, XRES, zoom, pos);
|
show_buffer(buf, skip, nibbles, CH_XOFF, XRES, zoom, pos);
|
||||||
show_freq(freq, zoom);
|
show_freq(freq, zoom);
|
||||||
si_text(POS_X, POS_Y, pos/freq, "s", 7);
|
show_position(freq, pos);
|
||||||
hlineColor(surf, 0, XRES-1, MEAS_DIV_Y, DIV_RGBA);
|
|
||||||
update();
|
update();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user