-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot.hpp
102 lines (87 loc) · 2.95 KB
/
plot.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#pragma once
#include "common.hpp"
#include <mculib/small_function.hpp>
#ifndef DISPLAY_ST7796
#define LCD_WIDTH 320
#define LCD_HEIGHT 240
// Offset of plot area
#define OFFSETX 10
#define OFFSETY 0
// WIDTH better be n*(POINTS_COUNT-1)
#define WIDTH 300
// HEIGHT = 8*GRIDY
#define HEIGHT 232
//#define NGRIDY 10
#define NGRIDY 8
#define FREQUENCIES_XPOS1 OFFSETX
#define FREQUENCIES_XPOS2 206
#define FREQUENCIES_XPOS3 135
#define FREQUENCIES_YPOS (240-7)
#else
#define LCD_WIDTH 480
#define LCD_HEIGHT 320
// Offset of plot area
#define OFFSETX 15
#define OFFSETY 0
// WIDTH better be n*(POINTS_COUNT-1)
#define WIDTH 455
// HEIGHT = 8*GRIDY
#define HEIGHT 304
//#define NGRIDY 10
#define NGRIDY 8
#define FREQUENCIES_XPOS1 OFFSETX
#define FREQUENCIES_XPOS2 320
#define FREQUENCIES_XPOS3 200
#define FREQUENCIES_YPOS (320-12)
#endif
// GRIDX calculated depends from frequency span
//#define GRIDY 29
#define GRIDY (HEIGHT / NGRIDY)
// Plot area size and left offset
#define CELLOFFSETX 5
#define AREA_WIDTH_NORMAL (CELLOFFSETX + WIDTH + 1 + 4)
#define AREA_HEIGHT_NORMAL ( HEIGHT + 1)
// Smith/polar chart
#define P_CENTER_X (CELLOFFSETX + WIDTH/2)
#define P_CENTER_Y (HEIGHT/2)
#define P_RADIUS (HEIGHT/2)
extern int area_width;
extern int area_height;
// for debugging plots
extern bool plot_checkerBoard; // draw a checkerboard pattern that indicates where the cells are
extern bool plot_shadeCells; // shade all drawn cells from now on
// this function is called to determine frequency in hz at a marker point
extern small_function<freqHz_t(int index)> plot_getFrequencyAt;
// this function is called periodically during plotting and can be used
// to process events in the event queue.
extern small_function<void()> plot_tick;
void plot_init(void);
// mark a cell for redraw. x: 0 to 15; y: 0 to 7
//void mark_map(int x, int y);
// cancel ongoing draw operations further up the stack
void plot_cancel();
// enable/disable draw_all()
void enable_redraw(bool enable);
void recalculate_grid(void);
void update_grid(void);
void request_to_redraw_grid(void);
void redraw_frame(void);
//void redraw_all(void);
void request_to_draw_cells_behind_menu(void);
void request_to_draw_cells_behind_numeric_input(void);
void request_to_redraw_marker(int marker);
void redraw_marker(int marker);
void trace_get_info(int t, char *buf, int len);
float groupdelay_from_array(int i, complexf array[SWEEP_POINTS_MAX]);
void plot_into_index(complexf measured[2][SWEEP_POINTS_MAX]);
void force_set_markmap(void);
void draw_all(bool flush);
void draw_all_cells(bool flush_markmap);
void draw_frequencies(void);
void draw_cal_status(void);
void markmap_all_markers(void);
void marker_position(int m, int t, int *x, int *y);
int search_nearest_index(int x, int y, int t);
int marker_search(MarkerSearchModes mode);
int marker_search_left(MarkerSearchModes mode, int from);
int marker_search_right(MarkerSearchModes mode, int from);