** Function name: BootScreen ** Description: Start Display functions and display bootscreen ***************************************************************************************/
| 170 | ** Description: Start Display functions and display bootscreen |
| 171 | ***************************************************************************************/ |
| 172 | void 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 { |
no test coverage detected