2018-08-31 18:05:38 +00:00
|
|
|
#define DISPLAY_MEAS_INTERVAL 0.1 /* time (in seconds) for each measurement values interval */
|
|
|
|
#define DISPLAY_INTERVAL 0.04 /* time (in seconds) for each other interval */
|
|
|
|
#define DISPLAY_PARAM_HISTORIES 10 /* number of intervals (should result in one seconds) */
|
2017-02-05 07:54:56 +00:00
|
|
|
|
2017-01-07 18:53:43 +00:00
|
|
|
#define MAX_DISPLAY_WIDTH 1024
|
|
|
|
|
|
|
|
typedef struct display_wave {
|
2018-01-21 08:30:00 +00:00
|
|
|
int kanal;
|
2017-01-07 18:53:43 +00:00
|
|
|
int interval_pos;
|
|
|
|
int interval_max;
|
|
|
|
int offset;
|
2017-01-27 15:57:34 +00:00
|
|
|
sample_t buffer[MAX_DISPLAY_WIDTH];
|
2017-01-07 18:53:43 +00:00
|
|
|
} dispwav_t;
|
|
|
|
|
2017-09-25 16:46:50 +00:00
|
|
|
enum display_measurements_type {
|
|
|
|
DISPLAY_MEAS_LAST, /* display last value */
|
|
|
|
DISPLAY_MEAS_PEAK, /* display peak value */
|
|
|
|
DISPLAY_MEAS_PEAK2PEAK, /* display peak value of min..max range */
|
|
|
|
DISPLAY_MEAS_AVG, /* display average value */
|
|
|
|
};
|
|
|
|
|
|
|
|
enum display_measurements_bar {
|
|
|
|
DISPLAY_MEAS_LEFT, /* bar graph from left */
|
|
|
|
DISPLAY_MEAS_CENTER, /* bar graph from center */
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct display_measurements_param {
|
|
|
|
struct display_measurements_param *next;
|
|
|
|
char name[32]; /* parameter name (e.g. 'Deviation') */
|
|
|
|
char format[32]; /* unit name (e.g. "%.2f KHz") */
|
|
|
|
enum display_measurements_type type;
|
|
|
|
enum display_measurements_bar bar;
|
|
|
|
double min; /* minimum value */
|
|
|
|
double max; /* maximum value */
|
|
|
|
double mark; /* mark (target) value */
|
|
|
|
double value; /* current value (peak, sum...) */
|
|
|
|
double value2; /* max value for min..max range */
|
|
|
|
double last; /* last valid value (used for DISPLAY_MEAS_LAST) */
|
|
|
|
int value_count; /* count number of values of one interval */
|
|
|
|
double value_history[DISPLAY_PARAM_HISTORIES]; /* history of values of last second */
|
|
|
|
double value2_history[DISPLAY_PARAM_HISTORIES]; /* stores max for min..max range */
|
|
|
|
int value_history_pos; /* next history value to write */
|
|
|
|
} dispmeasparam_t;
|
|
|
|
|
|
|
|
typedef struct display_measurements {
|
2018-01-21 08:30:00 +00:00
|
|
|
struct display_measurements *next;
|
|
|
|
int kanal;
|
|
|
|
dispmeasparam_t *param;
|
2017-09-25 16:46:50 +00:00
|
|
|
} dispmeas_t;
|
|
|
|
|
2017-09-24 12:13:34 +00:00
|
|
|
#define MAX_DISPLAY_IQ 1024
|
2017-01-07 18:53:43 +00:00
|
|
|
|
|
|
|
typedef struct display_iq {
|
|
|
|
int interval_pos;
|
|
|
|
int interval_max;
|
2017-02-05 07:54:56 +00:00
|
|
|
float buffer[MAX_DISPLAY_IQ * 2];
|
2017-01-07 18:53:43 +00:00
|
|
|
} dispiq_t;
|
|
|
|
|
2017-05-17 12:11:48 +00:00
|
|
|
#define MAX_DISPLAY_SPECTRUM 1024
|
2017-02-05 07:54:56 +00:00
|
|
|
|
2018-01-21 08:30:00 +00:00
|
|
|
typedef struct display_spectrum_mark {
|
|
|
|
struct display_spectrum_mark *next;
|
|
|
|
int kanal;
|
|
|
|
double frequency;
|
|
|
|
} dispspectrum_mark_t;
|
|
|
|
|
2017-02-05 07:54:56 +00:00
|
|
|
typedef struct display_spectrum {
|
|
|
|
int interval_pos;
|
|
|
|
int interval_max;
|
|
|
|
double buffer_I[MAX_DISPLAY_SPECTRUM];
|
|
|
|
double buffer_Q[MAX_DISPLAY_SPECTRUM];
|
2018-01-21 08:30:00 +00:00
|
|
|
dispspectrum_mark_t *mark;
|
2017-02-05 07:54:56 +00:00
|
|
|
} dispspectrum_t;
|
|
|
|
|
2017-05-25 16:43:54 +00:00
|
|
|
#define MAX_HEIGHT_STATUS 32
|
|
|
|
|
2018-01-21 08:30:00 +00:00
|
|
|
void display_wave_init(dispwav_t *disp, int samplerate, int kanal);
|
2017-01-07 18:53:43 +00:00
|
|
|
void display_wave_on(int on);
|
2018-01-21 08:30:00 +00:00
|
|
|
void display_wave(dispwav_t *disp, sample_t *samples, int length, double range);
|
2017-01-07 18:53:43 +00:00
|
|
|
|
2017-05-25 16:43:54 +00:00
|
|
|
void display_status_on(int on);
|
|
|
|
void display_status_start(void);
|
|
|
|
void display_status_channel(int channel, const char *type, const char *state);
|
|
|
|
void display_status_subscriber(const char *number, const char *state);
|
|
|
|
void display_status_end(void);
|
|
|
|
|
2018-01-21 08:30:00 +00:00
|
|
|
void display_measurements_init(dispmeas_t *disp, int samplerate, int kanal);
|
|
|
|
void display_measurements_exit(dispmeas_t *disp);
|
2017-09-25 16:46:50 +00:00
|
|
|
void display_measurements_on(int on);
|
2018-01-21 08:30:00 +00:00
|
|
|
dispmeasparam_t *display_measurements_add(dispmeas_t *disp, char *name, char *format, enum display_measurements_type type, enum display_measurements_bar bar, double min, double max, double mark);
|
2017-09-25 16:46:50 +00:00
|
|
|
void display_measurements_update(dispmeasparam_t *param, double value, double value2);
|
|
|
|
void display_measurements(double elapsed);
|
|
|
|
|
2017-01-07 18:53:43 +00:00
|
|
|
void display_iq_init(int samplerate);
|
|
|
|
void display_iq_on(int on);
|
|
|
|
void display_iq(float *samples, int length);
|
|
|
|
|
2017-09-02 13:41:11 +00:00
|
|
|
void display_spectrum_init(int samplerate, double center_frequency);
|
2018-01-21 08:30:00 +00:00
|
|
|
void display_spectrum_add_mark(int kanal, double frequency);
|
|
|
|
void display_spectrum_exit(void);
|
2017-02-05 07:54:56 +00:00
|
|
|
void display_spectrum_on(int on);
|
|
|
|
void display_spectrum(float *samples, int length);
|
2017-05-25 16:43:54 +00:00
|
|
|
|