Skip to content

Commit

Permalink
Add frequency span debug text
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansuchocki committed Dec 22, 2022
1 parent 86baa93 commit 4f3fe8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* API
******************************************************************************/

void display_open(unsigned sample_rate);
void display_open(unsigned open_sample_rate);
void display_close(void);
void display_update_bg(unsigned sample_rate);
void display_update_bg(unsigned update_sample_rate);
void display_update(const double *dbm_values);
14 changes: 9 additions & 5 deletions src/display/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,20 @@ static void render_debug_line(void);
static fb_t fb;
static fb_buf_t bg;

static unsigned sample_rate;

/*******************************************************************************
* Code
******************************************************************************/

void display_open(unsigned sample_rate)
void display_open(unsigned open_sample_rate)
{
fb = fb_init(config.x_window);

waterfall_init();

fb.open();
display_update_bg(sample_rate);
display_update_bg(open_sample_rate);
fb.draw();
}

Expand All @@ -52,8 +54,10 @@ void display_close(void)
fb.close();
}

void display_update_bg(unsigned sample_rate)
void display_update_bg(unsigned update_sample_rate)
{
sample_rate = update_sample_rate;

spectrogram_render_bg(&bg);

// Horizontal lines
Expand Down Expand Up @@ -99,14 +103,14 @@ void render_debug_line(void)
{
static time_t t_last = 0;
static int count = 0;
static char debug_line[20];
static char debug_line[100];

count++;
time_t t_now = time(NULL);

if (t_now > t_last)
{
snprintf(debug_line, 20, "%ifps", count);
snprintf(debug_line, 100, "%ifps %ukHz", count, sample_rate / 1000);
count = 0;
t_last = t_now;
}
Expand Down

0 comments on commit 4f3fe8e

Please sign in to comment.