-
Notifications
You must be signed in to change notification settings - Fork 1
/
LedStatus.hpp
55 lines (45 loc) · 1.39 KB
/
LedStatus.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
#ifndef LED_STATUS_HPP
#define LED_STATUS_HPP
#include <map>
#include <list>
#include <algorithm>
#include "TrackSegment.hpp"
enum LedColor
{
// Red, Green, Blue
LED_COLOR_BLACK = 0x000000,
LED_COLOR_RED = 0xFF0000,
LED_COLOR_GREEN = 0x00FF00,
LED_COLOR_BLUE = 0x0000FF,
LED_COLOR_YELLOW = 0xFFFF00,
LED_COLOR_CYAN = 0x00FFFF,
LED_COLOR_MAGENTA = 0xFF00FF,
LED_COLOR_WHITE = 0xFFFFFF,
LED_COLOR_PURPLE = 0x7F007F,
LED_COLOR_ORANGE = 0xFF7F00,
LED_COLOR_BROWN = 0x7F3F00,
LED_COLOR_LIME = 0x3FFF00,
LED_COLOR_PINK = 0xFF007F,
LED_COLOR_TURQUOISE = 0x00FF7F,
LED_COLOR_VIOLET = 0x7F00FF,
};
static std::map<TrackSegment, float> segmentBrightness{
{TrackSegment::SHORT_LINE, 0.05},
{TrackSegment::MEDIUM_LINE, 0.3},
{TrackSegment::LONG_LINE, 1.0},
{TrackSegment::XLONG_LINE, 1.0},
{TrackSegment::SHORT_CURVE, 0.05},
{TrackSegment::MEDIUM_CURVE, 0.3},
{TrackSegment::LONG_CURVE, 1.0},
{TrackSegment::XLONG_CURVE, 1.0},
{TrackSegment::ZIGZAG_TRACK, 1},
{TrackSegment::SPECIAL_TRACK, 0.05}
};
static std::map<CarState, LedColor> statusColor{
{CAR_TUNING, LED_COLOR_WHITE},
{CAR_MAPPING, LED_COLOR_YELLOW},
{CAR_ENC_READING_BEFORE_FIRSTMARK, LED_COLOR_PURPLE},
};
LedColor getStatusColor(CarState estado, TrackSegment segment);
float getSegmentBrightness(CarState estado, TrackSegment segment);
#endif