-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathEXTLedControlMenu.cpp
More file actions
74 lines (59 loc) · 2.23 KB
/
EXTLedControlMenu.cpp
File metadata and controls
74 lines (59 loc) · 2.23 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
#include "EXTLedControlMenu.h"
#include "core/display.h"
#include "core/utils.h"
#include "modules/EXTled_control/ext_led_control.h"
void EXTLedControlMenu::optionsMenu() {
returnToMenu = false;
options = {
{"Power", [=]() { power(); } },
{"Fade", [=]() { fade(); } },
{"Blink", [=]() { blink(); } },
{"Fast Blink", [=]() { FastBlink(); }},
{"Config", [=]() { LedConfig(); }},
{"Main Menu", [=]() { return; } },
};
// addOptionToMainMenu();
loopOptions(options, MENU_TYPE_SUBMENU, "Led Control");
};
void EXTLedControlMenu::drawIconImg() {
drawImg(
*bruceConfig.themeFS(), bruceConfig.getThemeItemImg(bruceConfig.theme.paths.led), 0, imgCenterY, true
);
}
// chatgpt part (: xd
void EXTLedControlMenu::drawIcon(float scale) {
clearIconArea();
// Setup sizes
int domeRadius = scale * 20;
int bodyWidth = domeRadius * 4;
int bodyHeight = scale * 12;
int legLength = scale * 16;
int x = iconCenterX;
int y = iconCenterY;
// --- Dome (semicircle top) using full circle + masking ---
tft.fillCircle(x, y, domeRadius, bruceConfig.priColor);
// Mask bottom half to simulate semicircle
tft.fillRect(x - domeRadius, y, domeRadius * 2, domeRadius, bruceConfig.bgColor);
// --- Rectangle body ---
int rectTop = y;
int rectLeft = x - bodyWidth / 2;
tft.fillRect(rectLeft, rectTop, bodyWidth, bodyHeight, bruceConfig.priColor);
// --- Legs ---
int legY = rectTop + bodyHeight;
int legOffsetX = scale * 4;
tft.fillRect(x - legOffsetX, legY, scale * 2, legLength, bruceConfig.priColor);
tft.fillRect(x + legOffsetX - scale * 2, legY, scale * 2, legLength, bruceConfig.priColor);
// --- Light rays ---
int rayLen = scale * 6;
int rayGap = scale * 5;
// Center ray
tft.drawLine(x, y - domeRadius - rayLen, x, y - domeRadius - scale, bruceConfig.priColor);
// Left ray
tft.drawLine(
x - rayGap, y - domeRadius - scale, x - rayGap + scale, y - domeRadius - rayLen, bruceConfig.priColor
);
// Right ray
tft.drawLine(
x + rayGap, y - domeRadius - scale, x + rayGap - scale, y - domeRadius - rayLen, bruceConfig.priColor
);
}