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

Function gsetRotation

src/settings.cpp:302–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300**********************************************************************/
301#define DRV 1
302int gsetRotation(bool set) {
303 int result = ROTATION;
304
305 if (rotation > 3) {
306 set = true;
307 result = ROTATION;
308 } else result = rotation;
309
310 if (set) {
311 options = {
312 {"Default", [&]() { result = ROTATION; } },
313#if TFT_WIDTH >= 200 && TFT_HEIGHT >= 200
314 {String("Portrait " + String(DRV == 1 ? 0 : 1)).c_str(), [&]() { result = (DRV == 1 ? 0 : 1); }},
315#endif
316 {String("Landscape " + String(DRV)).c_str(), [&]() { result = DRV; } },
317#if TFT_WIDTH >= 200 && TFT_HEIGHT >= 200
318 {String("Portrait " + String(DRV == 1 ? 2 : 3)).c_str(), [&]() { result = (DRV == 1 ? 2 : 3); }},
319#endif
320 {String("Landscape " + String(DRV + 2)).c_str(), [&]() { result = DRV + 2; } }
321 };
322 loopOptions(options);
323 rotation = result;
324
325 if (rotation & 0b1) {
326#if defined(HAS_TOUCH)
327 tftHeight = TFT_WIDTH - (FM * LH + 4);
328#else
329 tftHeight = TFT_WIDTH;
330#endif
331 tftWidth = TFT_HEIGHT;
332 } else {
333#if defined(HAS_TOUCH)
334 tftHeight = TFT_HEIGHT - (FM * LH + 4);
335#else
336 tftHeight = TFT_HEIGHT;
337#endif
338 tftWidth = TFT_WIDTH;
339 }
340
341 tft->setRotation(result);
342 tft->fillScreen(BGCOLOR);
343 }
344 return result;
345}
346/*********************************************************************
347** Function: setBrightnessMenu
348** Handles Menu to set brightness

Callers 1

settings_menuFunction · 0.85

Calls 3

loopOptionsFunction · 0.85
setRotationMethod · 0.45
fillScreenMethod · 0.45

Tested by

no test coverage detected