Merge pull request #379 from bobbycar-graz/fix-display-rotation
This commit is contained in:
@ -6,6 +6,9 @@
|
|||||||
#include <tftinstance.h>
|
#include <tftinstance.h>
|
||||||
#include <screenmanager.h>
|
#include <screenmanager.h>
|
||||||
|
|
||||||
|
// local includes
|
||||||
|
#include "screens.h"
|
||||||
|
|
||||||
void GameOfLifeDisplay::start()
|
void GameOfLifeDisplay::start()
|
||||||
{
|
{
|
||||||
Base::start();
|
Base::start();
|
||||||
@ -18,6 +21,8 @@ void GameOfLifeDisplay::initScreen()
|
|||||||
{
|
{
|
||||||
Base::initScreen();
|
Base::initScreen();
|
||||||
|
|
||||||
|
disableScreenFlip(true);
|
||||||
|
|
||||||
espgui::tft.setRotation(3);
|
espgui::tft.setRotation(3);
|
||||||
espgui::tft.fillScreen(TFT_BLACK);
|
espgui::tft.fillScreen(TFT_BLACK);
|
||||||
}
|
}
|
||||||
@ -45,7 +50,8 @@ void GameOfLifeDisplay::stop()
|
|||||||
{
|
{
|
||||||
Base::stop();
|
Base::stop();
|
||||||
|
|
||||||
espgui::tft.setRotation(0);
|
disableScreenFlip(false);
|
||||||
|
|
||||||
m_grid = nullptr;
|
m_grid = nullptr;
|
||||||
m_newgrid = nullptr;
|
m_newgrid = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
#include <tftinstance.h>
|
#include <tftinstance.h>
|
||||||
#include <screenmanager.h>
|
#include <screenmanager.h>
|
||||||
|
|
||||||
|
// local includes
|
||||||
|
#include <screens.h>
|
||||||
|
|
||||||
PingPongDisplay::PingPongDisplay() :
|
PingPongDisplay::PingPongDisplay() :
|
||||||
lpaddle_y(cpputils::randomNumber<uint8_t>(0, h - paddle_h, espcpputils::esp_random_device{})),
|
lpaddle_y(cpputils::randomNumber<uint8_t>(0, h - paddle_h, espcpputils::esp_random_device{})),
|
||||||
rpaddle_y(cpputils::randomNumber<uint8_t>(0, h - paddle_h, espcpputils::esp_random_device{})),
|
rpaddle_y(cpputils::randomNumber<uint8_t>(0, h - paddle_h, espcpputils::esp_random_device{})),
|
||||||
@ -19,6 +22,8 @@ void PingPongDisplay::initScreen()
|
|||||||
{
|
{
|
||||||
Base::initScreen();
|
Base::initScreen();
|
||||||
|
|
||||||
|
disableScreenFlip(true);
|
||||||
|
|
||||||
espgui::tft.fillScreen(TFT_BLACK);
|
espgui::tft.fillScreen(TFT_BLACK);
|
||||||
espgui::tft.setRotation(1);
|
espgui::tft.setRotation(1);
|
||||||
|
|
||||||
@ -41,7 +46,7 @@ void PingPongDisplay::stop()
|
|||||||
{
|
{
|
||||||
Base::stop();
|
Base::stop();
|
||||||
|
|
||||||
espgui::tft.setRotation(0);
|
disableScreenFlip(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PingPongDisplay::buttonPressed(espgui::Button button)
|
void PingPongDisplay::buttonPressed(espgui::Button button)
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
#include <screenmanager.h>
|
#include <screenmanager.h>
|
||||||
#include <tftinstance.h>
|
#include <tftinstance.h>
|
||||||
|
|
||||||
|
// local includes
|
||||||
|
#include "screens.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
typedef unsigned char byte;
|
typedef unsigned char byte;
|
||||||
} // namespace
|
} // namespace
|
||||||
@ -15,6 +18,7 @@ void SpiroDisplay::initScreen()
|
|||||||
{
|
{
|
||||||
Base::initScreen();
|
Base::initScreen();
|
||||||
|
|
||||||
|
disableScreenFlip(true);
|
||||||
espgui::tft.setRotation(3);
|
espgui::tft.setRotation(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +83,7 @@ void SpiroDisplay::stop()
|
|||||||
{
|
{
|
||||||
Base::stop();
|
Base::stop();
|
||||||
|
|
||||||
espgui::tft.setRotation(0);
|
disableScreenFlip(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpiroDisplay::buttonPressed(espgui::Button button)
|
void SpiroDisplay::buttonPressed(espgui::Button button)
|
||||||
|
@ -7,8 +7,9 @@
|
|||||||
#include <screenmanager.h>
|
#include <screenmanager.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "globals.h"
|
|
||||||
#include "displays/menus/demosmenu.h"
|
#include "displays/menus/demosmenu.h"
|
||||||
|
#include "globals.h"
|
||||||
|
#include "screens.h"
|
||||||
|
|
||||||
StarfieldDisplay::StarfieldDisplay() :
|
StarfieldDisplay::StarfieldDisplay() :
|
||||||
za(cpputils::randomNumber<uint8_t>(espcpputils::esp_random_device{})),
|
za(cpputils::randomNumber<uint8_t>(espcpputils::esp_random_device{})),
|
||||||
@ -22,6 +23,8 @@ void StarfieldDisplay::initScreen()
|
|||||||
{
|
{
|
||||||
Base::initScreen();
|
Base::initScreen();
|
||||||
|
|
||||||
|
disableScreenFlip(true);
|
||||||
|
|
||||||
espgui::tft.fillScreen(TFT_BLACK);
|
espgui::tft.fillScreen(TFT_BLACK);
|
||||||
espgui::tft.setRotation(1);
|
espgui::tft.setRotation(1);
|
||||||
|
|
||||||
@ -75,8 +78,7 @@ void StarfieldDisplay::redraw()
|
|||||||
void StarfieldDisplay::stop()
|
void StarfieldDisplay::stop()
|
||||||
{
|
{
|
||||||
Base::stop();
|
Base::stop();
|
||||||
|
disableScreenFlip(false);
|
||||||
espgui::tft.setRotation(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void StarfieldDisplay::buttonPressed(espgui::Button button)
|
void StarfieldDisplay::buttonPressed(espgui::Button button)
|
||||||
|
@ -13,6 +13,10 @@ using namespace espgui;
|
|||||||
|
|
||||||
Label bootLabel{32, 250};
|
Label bootLabel{32, 250};
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
bool disable_screen_flip{false};
|
||||||
|
}
|
||||||
|
|
||||||
void initScreen()
|
void initScreen()
|
||||||
{
|
{
|
||||||
// vertical screen
|
// vertical screen
|
||||||
@ -54,6 +58,7 @@ void updateDisplay()
|
|||||||
changeScreenCallback = {};
|
changeScreenCallback = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!disable_screen_flip)
|
||||||
updateRotation();
|
updateRotation();
|
||||||
|
|
||||||
if (const int8_t rawButton = rawButtonRequest.load(); rawButton != -1 && currentDisplay)
|
if (const int8_t rawButton = rawButtonRequest.load(); rawButton != -1 && currentDisplay)
|
||||||
@ -85,3 +90,8 @@ void redrawDisplay()
|
|||||||
currentDisplay->redraw();
|
currentDisplay->redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void disableScreenFlip(bool enable)
|
||||||
|
{
|
||||||
|
disable_screen_flip = enable;
|
||||||
|
}
|
||||||
|
@ -9,3 +9,4 @@ void initScreen();
|
|||||||
void updateDisplay();
|
void updateDisplay();
|
||||||
void updateRotation();
|
void updateRotation();
|
||||||
void redrawDisplay();
|
void redrawDisplay();
|
||||||
|
void disableScreenFlip(bool enable);
|
||||||
|
Reference in New Issue
Block a user