-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlRingSegmentDisplay.h
More file actions
82 lines (63 loc) · 1.93 KB
/
Copy pathControlRingSegmentDisplay.h
File metadata and controls
82 lines (63 loc) · 1.93 KB
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
//
// Created by codexzier on 29.04.26.
//
#pragma once
#include <Arduino.h>
#include <stdint.h>
#include "GC9A01_LTSM.hpp"
#ifndef CODEXZIER_VERSATRON_RINGSEGMENTDISPLAY_H
#define CODEXZIER_VERSATRON_RINGSEGMENTDISPLAY_H
class ControlRingSegmentDisplay {
private:
GC9A01_LTSM *_tft;
uint16_t _colorOn;
uint16_t _colorOff;
int _segmentsCount = 60;
const float _startAngle = 0.0f;
const float _angleStep = 1.0f;
bool _withBuffer = true;
int _segmentIndex = 0;
int _segmentValueOn = 0.0f;
bool _segmentsOnRing[121];
int _radiusOuter = 118;
int _radiusInner = 112;
float _segmentMultiplicator = 6.0;
void drawGaugeSegment(
float angleDeg,
uint16_t color,
float segmentWidth);
public:
explicit ControlRingSegmentDisplay(int radiusOuter, int radiusInner)
: _tft(nullptr), _colorOn(0), _colorOff(0),
_radiusOuter(radiusOuter), _radiusInner(radiusInner) { }
/**
* Initialize the ring segment display with the given TFT display and colors.
* @param tft The GC9A01_LTSM TFT display object.
* @param colorOn The color to use for segments that are on.
* @param colorOff The color to use for segments that are off.
*/
void init(GC9A01_LTSM &tft,
const uint16_t colorOn,
const uint16_t colorOff) {
_tft = &tft;
_colorOn = colorOn;
_colorOff = colorOff;
}
void drawInitGaugeSetup(int countSegments);
/**
* Set the value of the ring segment display.
* @param value The value to set, between 0 and 100.
*/
void setValue(int value);
void setColor(uint16_t color);
/**
* Get the current value of the ring segment display.
* @return The current value, between 0 and 100.
*/
int GetValue();
/**
* Update the display with the current value.
*/
void drawGaugeUpdate();
};
#endif //CODEXZIER_VERSATRON_RINGSEGMENTDISPLAY_H