libdebug: Remove dependency on MAX_DISPLAY_WIDTH

This commit is contained in:
Andreas Eversberg 2020-10-09 14:53:47 +02:00
parent f37dfbe4ee
commit 76c6304ae3
6 changed files with 16 additions and 4 deletions

View File

@ -101,8 +101,6 @@ void get_win_size(int *w, int *h)
*h = win.ws_row;
*w = win.ws_col;
if (*w > MAX_DISPLAY_WIDTH - 1)
*w = MAX_DISPLAY_WIDTH - 1;
}
void _printdebug(const char *file, const char __attribute__((unused)) *function, int line, int cat, int level, const char *kanal, const char *fmt, ...)

View File

@ -54,6 +54,8 @@ void display_iq_on(int on)
int w, h;
get_win_size(&w, &h);
if (w > MAX_DISPLAY_WIDTH - 1)
w = MAX_DISPLAY_WIDTH - 1;
if (iq_on) {
memset(&screen, ' ', sizeof(screen));
@ -113,6 +115,8 @@ void display_iq(float *samples, int length)
return;
get_win_size(&width, &h);
if (width > MAX_DISPLAY_WIDTH - 1)
width = MAX_DISPLAY_WIDTH - 1;
/* at what line we draw our zero-line and what character we use */
x_center = width >> 1;

View File

@ -102,6 +102,8 @@ static void print_measurements(int on)
int bar_width, bar_left, bar_right, bar_hold, bar_mark;
get_win_size(&width, &h);
if (width > MAX_DISPLAY_WIDTH - 1)
width = MAX_DISPLAY_WIDTH - 1;
/* no display, if bar graph is less than one character */
bar_width = width - MAX_NAME_LEN - MAX_UNIT_LEN;

View File

@ -95,6 +95,8 @@ void display_spectrum_on(int on)
int w, h;
get_win_size(&w, &h);
if (w > MAX_DISPLAY_WIDTH - 1)
w = MAX_DISPLAY_WIDTH - 1;
if (spectrum_on) {
memset(&screen, ' ', sizeof(screen));
@ -139,8 +141,8 @@ void display_spectrum(float *samples, int length)
return;
get_win_size(&width, &h);
if (width > MAX_DISPLAY_WIDTH)
width = MAX_DISPLAY_WIDTH;
if (width > MAX_DISPLAY_WIDTH - 1)
width = MAX_DISPLAY_WIDTH - 1;
/* calculate size of FFT */
int m, fft_size = 0, fft_taps = 0;

View File

@ -37,6 +37,8 @@ static void print_status(int on)
int w, h;
get_win_size(&w, &h);
if (w > MAX_DISPLAY_WIDTH - 1)
w = MAX_DISPLAY_WIDTH - 1;
if (w > MAX_DISPLAY_WIDTH)
w = MAX_DISPLAY_WIDTH;

View File

@ -47,6 +47,8 @@ void display_wave_on(int on)
int w, h;
get_win_size(&w, &h);
if (w > MAX_DISPLAY_WIDTH - 1)
w = MAX_DISPLAY_WIDTH - 1;
if (wave_on) {
memset(&screen, ' ', sizeof(screen));
@ -101,6 +103,8 @@ void display_wave(dispwav_t *disp, sample_t *samples, int length, double range)
return;
get_win_size(&width, &h);
if (width > MAX_DISPLAY_WIDTH - 1)
width = MAX_DISPLAY_WIDTH - 1;
/* at what line we draw our zero-line and what character we use */
center_line = (HEIGHT - 1) >> 1;