-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGauges.h
69 lines (52 loc) · 1.87 KB
/
Gauges.h
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
#ifndef _GAUGES_H
#define _GAUGES_H
#include "Settings.h"
#include "Data.h"
#include "TFT_eSPI.h"
#include "Lock.h"
#include "Clickable.h"
#define SCALE_SPRITE_Y_OFFSET_12 2
#define SCALE_SPRITE_Y_OFFSET_16 3
#define GAUGES_LINE_SPACING 10
double calcX(int16_t startX, double deg, int16_t radius);
double calcY(int16_t startY, double deg, int16_t radius);
double rad(double);
enum Side {
LEFT, RIGHT, MID, TIME, SIDE_LAST
};
class Gauges {
public:
TFT_eSPI *tft;
SettingsClass::Field **gen;
Lock *lock;
SettingsClass::DataSource* selected;
double arrR[91], arrOffset[91], arrX[91], arrY[91];
TFT_eSprite* scaleSprite[2][5];
TFT_eSprite* needleUpdate;
TFT_eSprite* textUpdate;
boolean redraw[SIDE_LAST];
int16_t selectedInfoCoords[4]; // x, y, w, h;
bool selectedInfoVisible;
ulong selectedInfoTimestamp;
void init(TFT_eSPI *t, Lock *l);
void reInit();
void fillTables();
void createScaleSprites(Side side);
void prepare();
void clean();
void drawScalePiece(void* target, bool isSprite, int deg, int side, int offsetX, int offsetY, int length, int width, uint16_t color);
void drawScale(void* target, bool isSprite, int side, int offsetX, int offsetY, int w, int start, int end);
void updateNeedle(int side);
void updateText();
void drawSelectedInfo();
void clearSelectedInfo();
void setSelectedFromState();
void setSelected(Side, SettingsClass::DataSource selected);
void getSelected(SettingsClass::DataSource* selected);
void cycleData(Side side);
Clickable *leftGauge, *rightGauge, *midGauge, *date;
std::vector<Clickable*> clickables;
std::vector<Clickable*>* getClickables();
static void processEvent(GxFT5436::Event, void*);
};
#endif