MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / initDisplay

Function initDisplay

src/display.cpp:172–270  ·  view source on GitHub ↗

** Function name: BootScreen ** Description: Start Display functions and display bootscreen ***************************************************************************************/

Source from the content-addressed store, hash-verified

170** Description: Start Display functions and display bootscreen
171***************************************************************************************/
172void initDisplay(bool doAll) {
173#ifndef HEADLESS
174 static uint8_t _name = launcherRandom(0, 3);
175 String name = "@Pirata";
176 String txt;
177 int cor, _x, _y, show;
178
179#ifdef E_PAPER_DISPLAY // epaper display draws only once
180 static bool runOnce = false;
181 static long lastMillis = 0;
182 if (runOnce && launcherMillis() - lastMillis < 5000) {
183 vTaskDelay(50 / portTICK_PERIOD_MS);
184 return;
185 } else {
186 runOnce = true;
187 lastMillis = launcherMillis();
188 }
189#endif
190
191 if (_name == 1) name = "u/bmorcelli";
192 else if (_name == 2) name = "gh/bmorcelli";
193 tft->drawRoundRect(3, 3, tftWidth - 6, tftHeight - 6, 5, FGCOLOR);
194 tft->setTextSize(FP);
195 tft->setCursor(10, 10);
196 cor = 0;
197 show = launcherRandom(0, 40);
198 _x = tft->getCursorX();
199 _y = tft->getCursorY();
200
201 while (tft->getCursorY() < (tftHeight - (LH + 4))) {
202 cor = launcherRandom(0, 11);
203 tft->setTextSize(FP);
204 show = launcherRandom(0, 40);
205 if (show == 0 || doAll) {
206 if (cor == 10) {
207 txt = " ";
208 } else if (cor & 1) {
209 tft->setTextColor(odd_color, BGCOLOR);
210 txt = String(cor);
211 } else {
212 tft->setTextColor(even_color, BGCOLOR);
213 txt = String(cor);
214 }
215
216 if (_x >= (tftWidth - (LW * FP + 4))) {
217 _x = 10;
218 _y += LH * FP;
219 } else if (_x < 10) {
220 _x = 10;
221 }
222 if (_y >= (tftHeight - (LH * FP + LH * FP / 2))) break;
223 tft->setCursor(_x, _y);
224 if (_y > (tftHeight - (LH * FM + LH * FP / 2)) &&
225 _x >= (tftWidth - ((LW * FP + 4) + LW * FP * name.length()))) {
226 tft->setTextColor(FGCOLOR);
227 tft->print(name);
228 _x += LW * FP * name.length();
229 } else {

Callers 5

powerOffFunction · 0.85
powerOffFunction · 0.85
powerOffFunction · 0.85
initDisplayLoopFunction · 0.85
main.cppFile · 0.85

Calls 13

launcherRandomFunction · 0.85
launcherMillisFunction · 0.85
TouchFooter2Function · 0.85
printMethod · 0.80
drawRoundRectMethod · 0.45
setTextSizeMethod · 0.45
setCursorMethod · 0.45
getCursorXMethod · 0.45
getCursorYMethod · 0.45
setTextColorMethod · 0.45
drawCentreStringMethod · 0.45

Tested by

no test coverage detected