Skip to content

Commit 10bae84

Browse files
author
Clang Robot
committed
Committing clang-format changes
1 parent 8f632e0 commit 10bae84

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

src/boards/Inkplate6COLOR/Inkplate6COLORDriver.cpp

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -128,33 +128,48 @@ void IRAM_ATTR display_flush_callback(lv_display_t *disp, const lv_area_t *area,
128128
float minc = min(rf, min(gf, bf));
129129
float delta = maxc - minc;
130130

131-
float H = 0.0f; // hue 0–360
131+
float H = 0.0f; // hue 0–360
132132
float S = (maxc == 0) ? 0 : (delta / maxc);
133133
float V = maxc;
134134

135135
// Compute hue
136-
if (delta > 0.0001f) {
137-
if (maxc == rf) H = 60.0f * fmod(((gf - bf) / delta), 6.0f);
138-
else if (maxc == gf) H = 60.0f * (((bf - rf) / delta) + 2.0f);
139-
else H = 60.0f * (((rf - gf) / delta) + 4.0f);
136+
if (delta > 0.0001f)
137+
{
138+
if (maxc == rf)
139+
H = 60.0f * fmod(((gf - bf) / delta), 6.0f);
140+
else if (maxc == gf)
141+
H = 60.0f * (((bf - rf) / delta) + 2.0f);
142+
else
143+
H = 60.0f * (((rf - gf) / delta) + 4.0f);
140144
}
141-
if (H < 0) H += 360.0f;
145+
if (H < 0)
146+
H += 360.0f;
142147

143148
// Classification
144149
uint8_t color;
145150

146-
if (S < 0.12f) {
147-
if (V < 0.20f) color = INKPLATE_BLACK;
148-
else if (V > 0.85f) color = INKPLATE_WHITE;
149-
else color = INKPLATE_YELLOW;
151+
if (S < 0.12f)
152+
{
153+
if (V < 0.20f)
154+
color = INKPLATE_BLACK;
155+
else if (V > 0.85f)
156+
color = INKPLATE_WHITE;
157+
else
158+
color = INKPLATE_YELLOW;
159+
}
160+
else
161+
{
162+
if (H >= 190 && H < 260)
163+
color = INKPLATE_BLUE;
164+
else if (H >= 90 && H < 150)
165+
color = INKPLATE_GREEN;
166+
else if (H >= 15 && H < 45)
167+
color = INKPLATE_ORANGE;
168+
else if (H >= 45 && H < 90)
169+
color = INKPLATE_YELLOW;
170+
else
171+
color = INKPLATE_RED;
150172
}
151-
else {
152-
if (H >= 190 && H < 260) color = INKPLATE_BLUE;
153-
else if (H >= 90 && H < 150) color = INKPLATE_GREEN;
154-
else if (H >= 15 && H < 45) color = INKPLATE_ORANGE;
155-
else if (H >= 45 && H < 90) color = INKPLATE_YELLOW;
156-
else color = INKPLATE_RED;
157-
}
158173

159174

160175
// Apply 180° flip (Inkplate coordinate convention)

0 commit comments

Comments
 (0)